From 6229864dd01078bea0c638499d60722448a694ac Mon Sep 17 00:00:00 2001 From: Petr Ruzicka Date: Sun, 6 Nov 2022 06:47:51 +0100 Subject: [PATCH] refactor(megalinter): simplify mega-linter GH Action --- .github/workflows/mega-linter.yml | 34 +++---------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 0ccd54c83..344d91ced 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -1,4 +1,3 @@ ---- name: MegaLinter on: @@ -17,44 +16,17 @@ jobs: - name: Checkout Code uses: actions/checkout@v3 with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} fetch-depth: 0 - name: MegaLinter - id: ml - uses: megalinter/megalinter@v6 + uses: megalinter/megalinter@v6.13.0 env: BASH_SHFMT_ARGUMENTS: --indent 2 --space-redirects DISABLE_LINTERS: COPYPASTE_JSCPD,JSON_PRETTIER,MARKDOWN_MARKDOWN_LINK_CHECK,REPOSITORY_DEVSKIM,REPOSITORY_SEMGREP,SPELL_CSPELL,SPELL_PROSELINT,YAML_V8R FILTER_REGEX_EXCLUDE: '(.*\.ps1|CHANGELOG.md)' FORMATTERS_DISABLE_ERRORS: false + GITHUB_COMMENT_REPORTER: false + GITHUB_STATUS_REPORTER: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PRINT_ALPACA: false VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - - - name: Create Pull Request with applied fixes - id: cpr - 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) - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} - commit-message: "[MegaLinter] Apply linters automatic fixes" - title: "[MegaLinter] Apply linters automatic fixes" - labels: bot - - - name: Create PR output - 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) - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - - - name: Prepare commit - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) - run: sudo chown -Rc $UID .git/ - - - name: Commit and push applied linter fixes - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) - uses: stefanzweifel/git-auto-commit-action@v4 - with: - branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} - commit_message: "[MegaLinter] Apply linters fixes"