1
1
---
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
5
5
6
6
on :
7
7
# Trigger mega-linter at every push. Action will also be visible from Pull Requests to main
8
8
# push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
9
9
pull_request :
10
10
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
12
12
# Apply linter fixes configuration
13
13
APPLY_FIXES : all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
14
14
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:
19
19
cancel-in-progress : true
20
20
21
21
jobs :
22
- build :
23
- name : Mega-Linter
22
+ megalinter :
23
+ name : MegaLinter
24
24
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
25
31
steps :
26
32
# Git Checkout
27
33
- name : Checkout Code
28
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
34
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
29
35
with :
30
36
token : ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
31
- fetch-depth : 0
32
37
33
- # Mega-Linter
34
- - name : Mega-Linter
38
+ # MegaLinter
39
+ - name : MegaLinter
35
40
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
39
44
env :
40
45
# 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"
44
48
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"'
48
52
49
- # Upload Mega-Linter artifacts
53
+ # Upload MegaLinter artifacts
50
54
- 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
53
57
with :
54
- name : Mega-Linter reports
58
+ name : MegaLinter reports
55
59
path : |
56
60
megalinter-reports
57
61
mega-linter.log
58
62
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
-
75
63
# Push new commit if applicable (for now works only on PR from same repository, not from forks)
76
64
- name : Prepare commit
77
65
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')
78
66
run : sudo chown -Rc $UID .git/
79
67
- name : Commit and push applied linter fixes
80
68
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
82
70
with :
83
71
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