ci: fail if formatting is recommended (#660) #2889
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# _ _ _ _ _____ _ | |
# | | | | | | | | | __ \(_) | |
# | | ___ | |__ _ __ | |_| |__ ___ | |__) |_ _ __ _ __ ___ _ __ | |
# _ | |/ _ \| '_ \| '_ \ | __| '_ \ / _ \ | _ /| | '_ \| '_ \ / _ \ '__| | |
# | |__| | (_) | | | | | | | | |_| | | | __/ | | \ \| | |_) | |_) | __/ | | |
# \____/ \___/|_| |_|_| |_| \__|_| |_|\___| |_| \_\_| .__/| .__/ \___|_| | |
# | | | | | |
# |_| |_| | |
# | |
# Copyright (c) 2021-2024 Claudio André <dev at claudioandre.slmail.me> | |
# | |
# This program comes with ABSOLUTELY NO WARRANTY; express or implied. | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, as expressed in version 2, seen at | |
# http://www.gnu.org/licenses/gpl-2.0.html | |
############################################################################### | |
# GitHub Action to run some linters | |
# More info at https://github.com/openwall/john-packages | |
--- | |
name: Linter | |
"on": | |
pull_request: | |
push: | |
branches-ignore: [main] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: linter | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
api0.prismacloud.io:443 | |
checkpoint-api.hashicorp.com:443 | |
github.com:443 | |
pypi.org:443 | |
raw.githubusercontent.com:443 | |
registry.terraform.io:443 | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: Linter | |
uses: super-linter/super-linter@e1cb86b6e8d119f789513668b4b30bf17fe1efe4 # v7.2.0 | |
env: | |
ENABLE_COMMITLINT_STRICT_MODE: true | |
ENFORCE_COMMITLINT_CONFIGURATION_CHECK: true | |
FILTER_REGEX_EXCLUDE: "^/github/workspace/snapcraft.yaml$" # Workaround for Prettier itself | |
FIX_JAVASCRIPT_PRETTIER: true | |
FIX_JSON_PRETTIER: true | |
FIX_MARKDOWN_PRETTIER: true | |
FIX_YAML_PRETTIER: true | |
VALIDATE_GIT_MERGE_CONFLICT_MARKERS: false # See https://github.com/super-linter/super-linter/pull/6374 | |
DEFAULT_BRANCH: "main" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check | |
run: | | |
echo "You should format source code properly!" | |
echo "**********************************************************************" | |
git diff | |
echo "**********************************************************************" | |
git diff --quiet |