Skip to content

Commit 61b8468

Browse files
chore: modernize GitHub Actions infrastructure (#2)
- Pin all GitHub Actions to commit SHAs for supply-chain security - Add explicit `permissions` blocks (least-privilege principle) - Add `concurrency` groups to all reusable workflows - Add missing `env: GITHUB_TOKEN` to release-drafter step - Fix `config-name` leading slash in release-drafter and pr-labeler - Migrate legacy probot `stale.yml` config → `actions/stale` workflow - Add `dependabot.yml` for automated weekly Actions dependency updates Agent-Logs-Url: https://github.com/commit-check/.github/sessions/cc1f1a40-13f2-447b-8820-b26e1959a320 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
1 parent 6ec7a88 commit 61b8468

6 files changed

Lines changed: 70 additions & 27 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
commit-message:
10+
prefix: "ci"
11+
labels:
12+
- "dependencies"

.github/stale.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/pr-labeler.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: PR Labeler
33
on:
44
workflow_call:
55

6+
concurrency:
7+
group: pr-labeler-${{ github.ref }}
8+
cancel-in-progress: true
9+
610
jobs:
711
label_pr:
812
permissions:
@@ -16,4 +20,4 @@ jobs:
1620
env:
1721
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1822
with:
19-
config-name: github:commit-check/.github:/.github/release-drafter.yml
23+
config-name: github:commit-check/.github:.github/release-drafter.yml

.github/workflows/pre-commit.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,33 @@ name: Run pre-commit
22

33
on:
44
workflow_call:
5-
inputs:
5+
inputs:
66
commands:
77
required: false
88
type: string
99
default: ""
1010
description: run additional commands for preparing the environment
1111

12+
concurrency:
13+
group: pre-commit-${{ github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
pre-commit:
1418
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
1521
steps:
16-
- uses: actions/checkout@v4
17-
- uses: actions/setup-python@v5
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
23+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
1824
id: python-setup
1925
with:
2026
python-version: '3.x'
2127
- name: Run commands
2228
if: inputs.commands
2329
run: ${{ inputs.commands }}
2430
- name: Cache pre-commit environments
25-
uses: actions/cache@v4
31+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
2632
with:
2733
path: '~/.cache/pre-commit'
2834
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

.github/workflows/release-drafter.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Release Drafter
33
on:
44
workflow_call:
55

6+
concurrency:
7+
group: release-drafter-${{ github.ref }}
8+
cancel-in-progress: true
9+
610
jobs:
711
update_release_draft:
812
permissions:
@@ -14,6 +18,8 @@ jobs:
1418
runs-on: ubuntu-latest
1519
steps:
1620
# Draft your next Release notes as Pull Requests are merged into the default branch
17-
- uses: release-drafter/release-drafter@v6
21+
- uses: release-drafter/release-drafter@6a93d829887aa2e0748befe2e808c66c0ec6e4c7 # v6
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1824
with:
19-
config-name: github:commit-check/.github:/.github/release-drafter.yml
25+
config-name: github:commit-check/.github:.github/release-drafter.yml

.github/workflows/stale.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: stale
10+
cancel-in-progress: true
11+
12+
jobs:
13+
stale:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
steps:
19+
- uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9
20+
with:
21+
days-before-stale: 60
22+
days-before-close: 7
23+
exempt-issue-labels: 'pinned,security,bug'
24+
stale-issue-label: 'wontfix'
25+
stale-issue-message: >
26+
This issue has been automatically marked as stale because it has not had
27+
recent activity. It will be closed if no further activity occurs. Thank you
28+
for your contributions.
29+
close-issue-message: false
30+
stale-pr-label: 'wontfix'
31+
stale-pr-message: >
32+
This pull request has been automatically marked as stale because it has not had
33+
recent activity. It will be closed if no further activity occurs. Thank you
34+
for your contributions.
35+
close-pr-message: false

0 commit comments

Comments
 (0)