|
6 | 6 | runs-on: |
7 | 7 | description: >- |
8 | 8 | Runner label. Defaults to ubuntu-latest. Override to a self-hosted |
9 | | - runner label if you want to run CI on your own scale set; pair with |
10 | | - runner-labels so actionlint accepts the label. |
| 9 | + runner label if you want to run CI on your own scale set. To |
| 10 | + register custom self-hosted runner labels with actionlint, commit |
| 11 | + a .github/actionlint.yaml file in the calling repo — see |
| 12 | + https://github.com/rhysd/actionlint/blob/main/docs/config.md. |
11 | 13 | required: false |
12 | 14 | default: ubuntu-latest |
13 | 15 | type: string |
|
21 | 23 | required: false |
22 | 24 | default: v1.7.12 |
23 | 25 | type: string |
24 | | - runner-labels: |
25 | | - description: >- |
26 | | - Comma- or newline-separated list of self-hosted runner label names |
27 | | - (e.g. "fast-runner,gpu-runner"). When set, the workflow writes a |
28 | | - temporary .github/actionlint.yaml registering these labels so |
29 | | - actionlint doesn't flag `runs-on: <label>` as unknown. Ignored if |
30 | | - the calling repo already commits a .github/actionlint.yaml. Leave |
31 | | - empty (default) if you only use GitHub-hosted runners or ship your |
32 | | - own actionlint config. |
33 | | - required: false |
34 | | - default: "" |
35 | | - type: string |
36 | 26 |
|
37 | 27 | permissions: |
38 | 28 | contents: read |
|
57 | 47 | GOBIN="$RUNNER_TEMP/bin" go install github.com/rhysd/actionlint/cmd/actionlint@${{ inputs.actionlint-version }} |
58 | 48 | echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH" |
59 | 49 |
|
60 | | - # Register self-hosted runner labels with actionlint when the caller |
61 | | - # passes them as input. Skipped if the calling repo already ships its |
62 | | - # own .github/actionlint.yaml — that takes precedence. |
63 | | - - name: Register runner labels |
64 | | - if: inputs.runner-labels != '' |
65 | | - shell: bash |
66 | | - env: |
67 | | - LABELS: ${{ inputs.runner-labels }} |
68 | | - run: | |
69 | | - if [ -f .github/actionlint.yaml ] || [ -f .github/actionlint.yml ]; then |
70 | | - echo "Calling repo provides its own .github/actionlint.yaml — leaving untouched" |
71 | | - exit 0 |
72 | | - fi |
73 | | - mkdir -p .github |
74 | | - { |
75 | | - echo "self-hosted-runner:" |
76 | | - echo " labels:" |
77 | | - echo "${LABELS}" | tr ',' '\n' | while IFS= read -r label; do |
78 | | - label="$(echo "${label}" | tr -d '[:space:]')" |
79 | | - [ -n "${label}" ] && echo " - ${label}" |
80 | | - done |
81 | | - } > .github/actionlint.yaml |
82 | | - echo "Wrote .github/actionlint.yaml from runner-labels input:" |
83 | | - cat .github/actionlint.yaml |
84 | | -
|
85 | 50 | - name: Run actionlint |
86 | 51 | id: actionlint |
87 | 52 | run: actionlint |
|
0 commit comments