Repository navigation
61 lines (50 loc) · 1.6 KB
/
Copy pathtest-yaml.yml
File metadata and controls
61 lines (50 loc) · 1.6 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Test YAML
on:
push:
branches:
- '**'
- '!gh-readonly-queue/**'
merge_group:
concurrency:
group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }}
cancel-in-progress: true
# Minimal permissions - only read access needed for checks
permissions:
contents: read
jobs:
test-yaml:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install yamllint
run: pip install yamllint
- name: Lint YAML files
id: yamllint-check
run: |
set -o pipefail
yamllint -f parsable -d '{rules: {line-length: disable}}' . 2>&1 | tee ./yamllint-output.txt
- name: Get PR info
id: get-pr-info
if: always() && startsWith(github.ref_name, 'pull-request/')
uses: nv-gha-runners/get-pr-info@main
- name: Save PR comment data
if: always()
run: |
mkdir -p ./pr-comment-data
PR_NUMBER='${{ startsWith(github.ref_name, 'pull-request/') && fromJSON(steps.get-pr-info.outputs.pr-info).number || '' }}'
echo "${PR_NUMBER}" > ./pr-comment-data/pr_number
if [ -f ./yamllint-output.txt ]; then
cp ./yamllint-output.txt ./pr-comment-data/error_output
fi
- name: Upload PR comment data
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-comment-data
path: pr-comment-data/
retention-days: 1