11---
2- # Mega-Linter GitHub Action configuration file
3- # More info at https://oxsecurity.github.io/megalinter
4- name : Mega-Linter
2+ # MegaLinter GitHub Action configuration file
3+ # More info at https://megalinter.io
4+ name : MegaLinter
55
66on :
77 # Trigger mega-linter at every push. Action will also be visible from Pull Requests to main
88 # push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
99 pull_request :
1010
11- env : # Comment env block if you do not want to apply fixes
11+ env : # Comment env block if you don't want to apply fixes
1212 # Apply linter fixes configuration
1313 APPLY_FIXES : all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
1414 APPLY_FIXES_EVENT : pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
@@ -19,66 +19,56 @@ concurrency:
1919 cancel-in-progress : true
2020
2121jobs :
22- build :
23- name : Mega-Linter
22+ megalinter :
23+ name : MegaLinter
2424 runs-on : ubuntu-22.04
25+ permissions :
26+ # Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR
27+ # Remove the ones you do not need
28+ contents : write
29+ issues : write
30+ pull-requests : write
2531 steps :
2632 # Git Checkout
2733 - name : Checkout Code
28- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
34+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
2935 with :
3036 token : ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
31- fetch-depth : 0
3237
33- # Mega-Linter
34- - name : Mega-Linter
38+ # MegaLinter
39+ - name : MegaLinter
3540 id : ml
36- # You can override Mega-Linter flavor used to have faster performances
37- # More info at https://oxsecurity.github.io/megalinter /flavors/
38- uses : oxsecurity/megalinter/flavors/python@a7a0163b6c8ff7474a283d99a706e27483ddd80f # 7.10.0
41+ # You can override MegaLinter flavor used to have faster performances
42+ # More info at https://megalinter.io /flavors/
43+ uses : oxsecurity/megalinter/flavors/python@ec124f7998718d79379a3c5b39f5359952baf21d # 8.4.2
3944 env :
4045 # All available variables are described in documentation
41- # https://oxsecurity.github.io/megalinter/configuration/
42- 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. Set 'true' if you always want to lint all sources
43- DEFAULT_BRANCH : ${{ github.event_name == 'pull_request' && github.base_ref || 'main' }}
46+ # https://megalinter.io/configuration/
47+ VALIDATE_ALL_CODEBASE : " true"
4448 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45- # ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
46- PYTHON_RUFF_ARGUMENTS : ' --config= '' output-format="github"'' '
47- PYTHON_RUFF_FORMAT_ARGUMENTS : ' --config= '' output-format="github"'' '
49+ # ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
50+ PYTHON_RUFF_ARGUMENTS : --config pyproject.toml --config ' output-format="github"'
51+ PYTHON_RUFF_FORMAT_ARGUMENTS : --config pyproject.toml --config ' output-format="github"'
4852
49- # Upload Mega-Linter artifacts
53+ # Upload MegaLinter artifacts
5054 - name : Archive production artifacts
51- if : ${{ success() }} || ${{ failure() }}
52- uses : actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3 .1
55+ if : success() || failure()
56+ uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # 4.6 .1
5357 with :
54- name : Mega-Linter reports
58+ name : MegaLinter reports
5559 path : |
5660 megalinter-reports
5761 mega-linter.log
5862
59- # Create pull request if applicable (for now works only on PR from same repository, not from forks)
60- - name : Create Pull Request with applied fixes
61- id : cpr
62- 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')
63- uses : peter-evans/create-pull-request@c55203cfde3e5c11a452d352b4393e68b85b4533 # 6.0.3
64- with :
65- token : ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
66- commit-message : " [Mega-Linter] Apply linters automatic fixes"
67- title : " [Mega-Linter] Apply linters automatic fixes"
68- labels : bot
69- - name : Create PR output
70- 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')
71- run : |
72- echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
73- echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
74-
7563 # Push new commit if applicable (for now works only on PR from same repository, not from forks)
7664 - name : Prepare commit
7765 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) && !contains(github.event.head_commit.message, 'skip fix')
7866 run : sudo chown -Rc $UID .git/
7967 - name : Commit and push applied linter fixes
8068 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) && !contains(github.event.head_commit.message, 'skip fix')
81- uses : stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # 5.0.1
69+ uses : stefanzweifel/git-auto-commit-action@e348103e9026cc0eee72ae06630dbe30c8bf7a79 # 5.1.0
8270 with :
8371 branch : ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
84- commit_message : " [Mega-Linter] Apply linters fixes"
72+ commit_message : " [MegaLinter] Apply linters fixes"
73+ commit_user_name : newrelic-python-agent-team
74+ commit_user_email :
[email protected]
0 commit comments