Skip to content

Commit

Permalink
Update Megalinter (AliceO2Group#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
vkucera committed Sep 9, 2023
1 parent 8769db4 commit 6dd0567
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# MegaLinter GitHub Action configuration file
# More info at https://oxsecurity.github.io/megalinter
# More info at https://megalinter.io
name: MegaLinter

on:
Expand All @@ -10,22 +10,24 @@ on:
branches: [master, main]

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR
# Remove the ones you do not need
contents: write
issues: write
pull-requests: write

env: # Comment env block if you do not want to apply fixes
env: # Comment env block if you don't want to apply fixes
# Apply linter fixes configuration
APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
APPLY_FIXES_EVENT: push # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
APPLY_FIXES_MODE: pull_request # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
build:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
steps:
Expand All @@ -34,17 +36,17 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0
fetch-depth: 0 # If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to improve performances

# MegaLinter
- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://oxsecurity.github.io/megalinter/flavors/
uses: oxsecurity/megalinter@v6
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter@v7
env:
# All available variables are described in documentation
# https://oxsecurity.github.io/megalinter/configuration/
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: false # ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} # Validates all source when push on master, else just the git diff with master. Override with true if you always want to lint all sources
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
Expand All @@ -53,11 +55,11 @@ jobs:
# Upload MegaLinter artifacts
- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: MegaLinter reports
path: |
report
megalinter-reports
mega-linter.log
# Create pull request if applicable (for now works only on PR from same repository, not from forks)
Expand All @@ -80,7 +82,7 @@ jobs:
- 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 "::error::Merge pull request ${{ steps.cpr.outputs.pull-request-url }} to apply fixes."
echo "::error::Merge pull request ${{ steps.cpr.outputs.pull-request-url }} to apply automatic fixes."
exit 1
# Push new commit if applicable (for now works only on PR from same repository, not from forks)
Expand All @@ -97,3 +99,5 @@ jobs:
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: megalinter-bot
commit_user_email: nicolas.vuillamy@ox.security
1 change: 1 addition & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ DISABLE_LINTERS:
- YAML_V8R
- YAML_PRETTIER
- REPOSITORY_DEVSKIM
- REPOSITORY_KICS
- REPOSITORY_SECRETLINT
- REPOSITORY_TRIVY
DISABLE_ERRORS_LINTERS: # If errors are found by these linters, they will be considered as non blocking.
Expand Down

0 comments on commit 6dd0567

Please sign in to comment.