Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit 6229864

Browse files
committed
refactor(megalinter): simplify mega-linter GH Action
1 parent 5bbf034 commit 6229864

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

.github/workflows/mega-linter.yml

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
name: MegaLinter
32

43
on:
@@ -17,44 +16,17 @@ jobs:
1716
- name: Checkout Code
1817
uses: actions/checkout@v3
1918
with:
20-
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
2119
fetch-depth: 0
2220

2321
- name: MegaLinter
24-
id: ml
25-
uses: megalinter/megalinter@v6
22+
uses: megalinter/[email protected]
2623
env:
2724
BASH_SHFMT_ARGUMENTS: --indent 2 --space-redirects
2825
DISABLE_LINTERS: COPYPASTE_JSCPD,JSON_PRETTIER,MARKDOWN_MARKDOWN_LINK_CHECK,REPOSITORY_DEVSKIM,REPOSITORY_SEMGREP,SPELL_CSPELL,SPELL_PROSELINT,YAML_V8R
2926
FILTER_REGEX_EXCLUDE: '(.*\.ps1|CHANGELOG.md)'
3027
FORMATTERS_DISABLE_ERRORS: false
28+
GITHUB_COMMENT_REPORTER: false
29+
GITHUB_STATUS_REPORTER: true
3130
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3231
PRINT_ALPACA: false
3332
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
34-
35-
- name: Create Pull Request with applied fixes
36-
id: cpr
37-
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)
38-
uses: peter-evans/create-pull-request@v4
39-
with:
40-
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
41-
commit-message: "[MegaLinter] Apply linters automatic fixes"
42-
title: "[MegaLinter] Apply linters automatic fixes"
43-
labels: bot
44-
45-
- name: Create PR output
46-
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)
47-
run: |
48-
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
49-
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
50-
51-
- name: Prepare commit
52-
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)
53-
run: sudo chown -Rc $UID .git/
54-
55-
- name: Commit and push applied linter fixes
56-
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)
57-
uses: stefanzweifel/git-auto-commit-action@v4
58-
with:
59-
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
60-
commit_message: "[MegaLinter] Apply linters fixes"

0 commit comments

Comments
 (0)