From 0dbbc6414eb58f788b61479afd5dbfac03c74cea Mon Sep 17 00:00:00 2001 From: hamzabessa <148857497+hamzabessa@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:58:53 +0100 Subject: [PATCH] feat(ci): add linting to worflow and actions files (#4718) Co-authored-by: Kevin Duret --- .github/workflows/actionlint.yml | 68 ++++++++++++++++++++++++++++++++ .github/workflows/nrpe.yml | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/actionlint.yml diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml new file mode 100644 index 000000000..c1c365d44 --- /dev/null +++ b/.github/workflows/actionlint.yml @@ -0,0 +1,68 @@ +name: actionlint + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + pull_request: + branches: + - develop + - master + - hotfix-* + - release-* + paths: + - ".github/**" + +jobs: + actionlint: + runs-on: ubuntu-22.04 + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Download actionlint + id: get_actionlint + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + shell: bash + + - name: Check workflow files + run: | + ${{ steps.get_actionlint.outputs.executable }} \ + -ignore 'label "common" is unknown' \ + -ignore 'label "veracode" is unknown' \ + -ignore '"github.head_ref" is potentially untrusted' \ + -shellcheck= \ + -pyflakes= \ + -color + shell: bash + yaml-lint: + runs-on: ubuntu-22.04 + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Install Yaml + run: | + pip install yamllint==1.32.0 + + - name: Add Yaml Lint Rules + run: | + cat <>./yamllint_rules.yml + extends: default + + rules: + document-start: disable + line-length: disable + truthy: + check-keys: false + level: error + indentation: + spaces: 2 + indent-sequences: true + check-multi-line-strings: false + EOF + + - name: Lint YAML files + run: | + yamllint -c ./yamllint_rules.yml ./.github/actions/ ./.github/workflows/ diff --git a/.github/workflows/nrpe.yml b/.github/workflows/nrpe.yml index 64ebca44f..64fdb4687 100644 --- a/.github/workflows/nrpe.yml +++ b/.github/workflows/nrpe.yml @@ -130,7 +130,7 @@ jobs: artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} deliver-deb: - needs: [get-environment ,package] + needs: [get-environment, package] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} runs-on: [self-hosted, common]