Skip to content

Commit

Permalink
Fix PDF Action
Browse files Browse the repository at this point in the history
  • Loading branch information
nopeitsnothing committed Jul 13, 2024
1 parent 3a12a09 commit bfb1461
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 54 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/create-pdf.yml

This file was deleted.

79 changes: 49 additions & 30 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,80 @@
---
# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
name: '✏️ MegaLinter'

permissions:
contents: read

on:
workflow_dispatch:
push:
pull_request:
branches:
- main
push:
branches:
- main
branches: [master, main]

env:
APPLY_FIXES: all
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

# Comment env block if you do not want to apply fixes
env:
# Apply linter fixes configuration
APPLY_FIXES: all

# Decide which event triggers application of fixes in a commit or a PR
APPLY_FIXES_EVENT: pull_request, push

# If APPLY_FIXES is used, defines if the fixes are directly committed (commit)
# or posted in a PR (pull_request)
APPLY_FIXES_MODE: commit

jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout repository
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0

# MegaLinter
- name: Run MegaLinter
- name: MegaLinter
id: ml
uses: oxsecurity/megalinter/flavors/[email protected]
env:
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISABLE: COPYPASTE,SPELL,HTML
DISABLE: COPYPASTE,SPELL,HTML
DISABLE_LINTERS: REPOSITORY_GITLEAKS,CSS_SCSS_LINT,BASH_SHELLCHECK,JSON_JSONLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_GIT_DIFF,YAML_V8R,MARKDOWN_MARKDOWNLINT_NO_TRAILING_SPACES,MARKDOWN_MARKDOWNLINT_NO_DUPLICATE_HEADING
DISABLE_ERRORS_LINTERS: CSS_STYLELINT,MARKDOWN_MARKDOWN_LINK_CHECK,YAML_YAMLLINT,DOCKERFILE_HADOLINT,REPOSITORY_TRIVY,REPOSITORY_CHECKOV,REPOSITORY_GITLEAKS
MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE: '(export/|briar\.md|donations\.md|LICENSE\.md)'
MARKDOWN_MARKDOWNLINT_FILTER_REGEX_EXCLUDE: '(export/|briar\.md|donations\.md|LICENSE\.md|guide\.md)'

# Upload MegaLinter artifacts
- name: Archive MegaLinter reports
- name: Archive production artifacts
if: success() || failure()
uses: actions/upload-artifact@v4
if: always() # Ensure artifacts are always uploaded
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
mega-linter.log
- name: Create Pull Request with applied fixes
id: cpr
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')
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- 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) && !contains(github.event.head_commit.message, 'skip fix')
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Prepare commit
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')
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
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')
uses: stefanzweifel/git-auto-commit-action@v4
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: [email protected]

0 comments on commit bfb1461

Please sign in to comment.