-
Notifications
You must be signed in to change notification settings - Fork 514
48 lines (42 loc) · 1.37 KB
/
yamllint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# yamllint disable rule:line-length rule:document-start rule:truthy
name: PR yamllint check
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
rebase:
name: yamllint check
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Install yamllint
run: pip install yamllint
- name: Lint YAML pipeline files
id: lint-pipeline
working-directory: ./tools/devops/automation
run: |
RESULT=$(yamllint . -f github)
if [ -n "$RESULT" ]; then
echo "YAML Lint found issues"
echo "$RESULT"
echo "::set-output name=result::$RESULT"
exit 1
fi
# only post a comment if the linting fails
- name: Post comment
uses: unsplash/comment-on-pr@v1.3.1
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: |
[yaml-lint] YamlLint found issues in the pipeline files.
${{ steps.lint-pipeline.outputs.result }}
check_for_duplicate_msg: true
delete_prev_regex_msg: "YamlLint found issues in the pipeline files."
duplicate_msg_pattern: "YamlLint found issues in the pipeline files."