-
Notifications
You must be signed in to change notification settings - Fork 790
105 lines (90 loc) · 3.25 KB
/
lint.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# SPDX-License-Identifier: Apache-2.0
name: Lint compositional_skills and knowledge
on:
workflow_dispatch:
push:
branches:
- main
paths:
- compositional_skills/**/qna.yaml
- knowledge/**/qna.yaml
- '.github/workflows/lint.yml' # This workflow
- 'scripts/**' # Scripts used by this workflow
pull_request:
branches:
- main
paths:
- compositional_skills/**/*.yaml
- compositional_skills/**/*.yml
- knowledge/**/*.yaml
- knowledge/**/*.yml
- '.github/workflows/lint.yml' # This workflow
- 'scripts/**' # Scripts used by this workflow
env:
LC_ALL: en_US.UTF-8
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- name: "Harden Runner"
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: "Checkout"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: "Setup Python"
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.11"
- name: "Install Python Packages"
run: |
pip install -r scripts/requirements.txt
- name: "Find changed skills and knowledge files"
id: changed-files
uses: tj-actions/changed-files@c3a1bb2c992d77180ae65be6ae6c166cf40f857c # v45.0.3
with:
files: |
compositional_skills/**/*.yaml
compositional_skills/**/*.yml
knowledge/**/*.yaml
knowledge/**/*.yml
- name: "Check changed YAML file contents"
if: ${{ fromJSON(steps.changed-files.outputs.any_changed) }}
run: |
scripts/check-yaml.py ${{ steps.changed-files.outputs.all_changed_files }}
env:
TAXONOMY_FOLDERS: >-
compositional_skills
knowledge
- name: "Check all YAML file contents"
if: ${{ !fromJSON(steps.changed-files.outputs.any_changed) }}
run: |
read -ra folders <<< "${TAXONOMY_FOLDERS}"
# shellcheck disable=SC2046
scripts/check-yaml.py $(find "${folders[@]}" -name "qna.yaml" -print)
env:
SCHEMA_VERSION: 0 # use the schema version specified in the "version" key
TAXONOMY_FOLDERS: >-
compositional_skills
knowledge
- name: "Save Pull Request number"
if: ${{ (github.event_name == 'pull_request') && (github.repository == 'instructlab/taxonomy') }}
run: |
echo "${PULL_REQUEST_NUMBER}" > pull_request_number.txt
env:
PULL_REQUEST_NUMBER: ${{ fromJSON(steps.changed-files.outputs.any_changed) && github.event.number || '0' }}
- name: "Upload Pull Request number"
if: ${{ (github.event_name == 'pull_request') && (github.repository == 'instructlab/taxonomy') }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: pull_request_number
path: pull_request_number.txt
if-no-files-found: error
retention-days: 5