feat(ci): add secrets to the megalinter job

This commit is contained in:
2024-06-17 12:19:29 +03:00
parent b4e4acde41
commit 170230ce9f

View File

@@ -5,6 +5,13 @@ name: MegaLinter
on:
workflow_call:
secrets:
gitea-token:
required: true
type: string
github-token:
required: false
type: string
env: # Comment env block if you don't want to apply fixes
# Apply linter fixes configuration
@@ -31,7 +38,7 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT || secrets.MEGALINTER_TOKEN }}
token: ${{ secrets.github-token || secrets.gitea-token }}
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances
# MegaLinter
@@ -44,7 +51,7 @@ jobs:
# All available variables are described in documentation
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} # Validates all source when push on main, else just the git diff with main. Override with true if you always want to lint all sources
MEGALINTER_TOKEN: ${{ secrets.MEGALINTER_TOKEN }}
MEGALINTER_TOKEN: ${{ secrets.gitea-token }}
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
# DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks
@@ -64,7 +71,7 @@ jobs:
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT || secrets.MEGALINTER_TOKEN }}
token: ${{ secrets.github-token || secrets.gitea-token }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot