feat(ci): add linting to worflow and actions files (#4718)

Co-authored-by: Kevin Duret <kduret@centreon.com>
This commit is contained in:
hamzabessa 2023-10-31 11:58:53 +01:00 committed by GitHub
parent 7d6b38da36
commit 0dbbc6414e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 1 deletions

68
.github/workflows/actionlint.yml vendored Normal file
View File

@ -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 <<EOF >>./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/

View File

@ -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]