GHA CI: add checking for GHA workflows

PR #22200.

---------

Co-authored-by: userdocs <16525024+userdocs@users.noreply.github.com>
This commit is contained in:
Chocobo1 2025-01-26 03:44:59 +08:00 committed by GitHub
parent e2341f5217
commit 3ef4d0d798
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 56 additions and 12 deletions

View File

@ -12,11 +12,15 @@ jobs:
ci: ci:
name: Check name: Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
security-events: write
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install tools - name: Setup python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: "*" python-version: "*"
@ -42,3 +46,26 @@ jobs:
done done
# check diff, ignore "Automatically generated by ..." part # check diff, ignore "Automatically generated by ..." part
git diff -I '\.\\".*' --exit-code git diff -I '\.\\".*' --exit-code
- name: Check GitHub Actions workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install zizmor
IGNORE_RULEID='(.ruleId != "template-injection")
and (.ruleId != "unpinned-uses")'
IGNORE_ID='(.id != "template-injection")
and (.id != "unpinned-uses")'
zizmor \
--format sarif \
--pedantic \
./ \
| jq "(.runs[].results |= map(select($IGNORE_RULEID)))
| (.runs[].tool.driver.rules |= map(select($IGNORE_ID)))" \
> "${{ runner.temp }}/zizmor_results.sarif"
- name: Upload zizmor results
uses: github/codeql-action/upload-sarif@v3
with:
category: zizmor
sarif_file: "${{ runner.temp }}/zizmor_results.sarif"

View File

@ -2,8 +2,7 @@ name: CI - macOS
on: [pull_request, push] on: [pull_request, push]
permissions: permissions: {}
actions: write
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -13,6 +12,8 @@ jobs:
ci: ci:
name: Build name: Build
runs-on: macos-latest runs-on: macos-latest
permissions:
actions: write
strategy: strategy:
fail-fast: false fail-fast: false
@ -28,6 +29,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies - name: Install dependencies
uses: Wandalen/wretry.action@v3 uses: Wandalen/wretry.action@v3

View File

@ -16,6 +16,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup python (auxiliary scripts) - name: Setup python (auxiliary scripts)
uses: actions/setup-python@v5 uses: actions/setup-python@v5

View File

@ -2,9 +2,7 @@ name: CI - Ubuntu
on: [pull_request, push] on: [pull_request, push]
permissions: permissions: {}
actions: write
security-events: write
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -14,6 +12,9 @@ jobs:
ci: ci:
name: Build name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
actions: write
security-events: write
strategy: strategy:
fail-fast: false fail-fast: false
@ -30,6 +31,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies - name: Install dependencies
run: | run: |

View File

@ -2,8 +2,7 @@ name: CI - WebUI
on: [pull_request, push] on: [pull_request, push]
permissions: permissions: {}
security-events: write
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -13,6 +12,8 @@ jobs:
ci: ci:
name: Check name: Check
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
security-events: write
defaults: defaults:
run: run:
@ -21,6 +22,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup nodejs - name: Setup nodejs
uses: actions/setup-node@v4 uses: actions/setup-node@v4

View File

@ -2,8 +2,7 @@ name: CI - Windows
on: [pull_request, push] on: [pull_request, push]
permissions: permissions: {}
actions: write
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@ -13,6 +12,8 @@ jobs:
ci: ci:
name: Build name: Build
runs-on: windows-latest runs-on: windows-latest
permissions:
actions: write
strategy: strategy:
fail-fast: false fail-fast: false
@ -27,6 +28,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup devcmd - name: Setup devcmd
uses: ilammy/msvc-dev-cmd@v1 uses: ilammy/msvc-dev-cmd@v1

View File

@ -26,6 +26,8 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies - name: Install dependencies
run: | run: |

View File

@ -4,12 +4,13 @@ on:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
permissions: permissions: {}
pull-requests: write
jobs: jobs:
stale: stale:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
pull-requests: write
steps: steps:
- name: Mark and close stale PRs - name: Mark and close stale PRs
uses: actions/stale@v9 uses: actions/stale@v9