Skip to content

Add MegaLinter GitHub Actions workflow #1

Add MegaLinter GitHub Actions workflow

Add MegaLinter GitHub Actions workflow #1

Workflow file for this run

# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
---
name: MegaLinter
# Trigger mega-linter at every push.
# Action will also be visible from Pull Requests to main
on:
push:
branches-ignore:
- main
pull_request:
branches:
- main
# Commentted out env block because we do not want to apply fixes
# env:
# # Apply linter fixes configuration
# #
# # When active, APPLY_FIXES must also be defined as environment variable
# # (in github/workflows/mega-linter.yml or other CI tool)
# APPLY_FIXES: all
# # Decide which event triggers application of fixes in a commit or a PR
# # (pull_request, push, all)
# APPLY_FIXES_EVENT: pull_request
# # If APPLY_FIXES is used, defines if the fixes are directly committed (commit)
# # or posted in a PR (pull_request)
# APPLY_FIXES_MODE: commit
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
# improve performance
fetch-depth: 0
# MegaLinter
- name: MegaLinter
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter@v7
id: ml
# All available variables are described in documentation
# https://megalinter.io/configuration/
env:
# Validates all source when push on main, else just the git diff with
# main. Override with true if you always want to lint all sources
VALIDATE_ALL_CODEBASE: >-
${{
github.event_name == 'push' &&
contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)
}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload MegaLinter artifacts
- name: Archive production artifacts
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log