-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add linting to worflow and actions files (#2769)
* feat(ci): add linting to worflow and actions files * fix: change branches on pr * fix: apply lenting on workflows only * fix: fixing errors related to lenting * fix: add label infra to runners
- Loading branch information
1 parent
c783906
commit 6190796
Showing
2 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: actionlint | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- staging | ||
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 "infra" 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/workflows/ |
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