Skip to content

Commit 8dcf95c

Browse files
committed
ci: harden workflow configuration
1 parent ba0b758 commit 8dcf95c

4 files changed

Lines changed: 33 additions & 10 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ permissions:
1515

1616
jobs:
1717
quality:
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-24.04
1919
timeout-minutes: 15
2020
steps:
2121
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -36,7 +36,7 @@ jobs:
3636
/tmp/github-backup-wheel-test/bin/github-backup help run
3737
3838
test:
39-
runs-on: ubuntu-latest
39+
runs-on: ubuntu-24.04
4040
timeout-minutes: 15
4141
strategy:
4242
fail-fast: false
@@ -52,7 +52,7 @@ jobs:
5252
- run: uv run pytest --cov=github_backup --cov-report=term-missing --cov-fail-under=80
5353

5454
docker:
55-
runs-on: ubuntu-latest
55+
runs-on: ubuntu-24.04
5656
timeout-minutes: 20
5757
steps:
5858
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

‎.github/workflows/release.yml‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ concurrency:
1616

1717
jobs:
1818
prepare:
19-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-24.04
2020
timeout-minutes: 10
2121
permissions:
2222
contents: write
@@ -27,6 +27,29 @@ jobs:
2727
tag: ${{ steps.target.outputs.tag }}
2828
version: ${{ steps.target.outputs.version }}
2929
steps:
30+
- name: Validate release automation configuration
31+
if: github.event_name == 'push'
32+
shell: bash
33+
env:
34+
RELEASE_APP_CLIENT_ID: ${{ vars.RELEASE_APP_CLIENT_ID }}
35+
RELEASE_APP_PRIVATE_KEY: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
36+
run: |
37+
set -euo pipefail
38+
missing=()
39+
[[ -n "$RELEASE_APP_CLIENT_ID" ]] || missing+=(RELEASE_APP_CLIENT_ID)
40+
[[ -n "$RELEASE_APP_PRIVATE_KEY" ]] || missing+=(RELEASE_APP_PRIVATE_KEY)
41+
if (( ${#missing[@]} > 0 )); then
42+
{
43+
echo "## Release automation is not configured"
44+
echo
45+
echo "Missing repository configuration: \`${missing[*]}\`."
46+
echo "Follow \`docs/RELEASING.md\` to install the least-privilege GitHub App, then rerun this workflow."
47+
} >> "$GITHUB_STEP_SUMMARY"
48+
printf 'Missing release automation configuration: %s\n' "${missing[*]}" >&2
49+
echo "See docs/RELEASING.md for the required GitHub App setup." >&2
50+
exit 1
51+
fi
52+
3053
- name: Create short-lived release automation token
3154
if: github.event_name == 'push'
3255
id: app-token
@@ -98,7 +121,7 @@ jobs:
98121
python-artifacts:
99122
needs: prepare
100123
if: needs.prepare.outputs.publish == 'true'
101-
runs-on: ubuntu-latest
124+
runs-on: ubuntu-24.04
102125
timeout-minutes: 20
103126
permissions:
104127
contents: read
@@ -176,7 +199,7 @@ jobs:
176199
container:
177200
needs: prepare
178201
if: needs.prepare.outputs.publish == 'true'
179-
runs-on: ubuntu-latest
202+
runs-on: ubuntu-24.04
180203
timeout-minutes: 60
181204
permissions:
182205
contents: read
@@ -250,7 +273,7 @@ jobs:
250273
needs.prepare.outputs.publish == 'true' &&
251274
needs.python-artifacts.result == 'success' &&
252275
needs.container.result == 'success'
253-
runs-on: ubuntu-latest
276+
runs-on: ubuntu-24.04
254277
timeout-minutes: 10
255278
permissions:
256279
contents: write

‎.github/workflows/scorecard.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions: read-all
1212

1313
jobs:
1414
analysis:
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-24.04
1616
timeout-minutes: 15
1717
permissions:
1818
contents: read

‎.github/workflows/security.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414

1515
jobs:
1616
codeql:
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-24.04
1818
timeout-minutes: 20
1919
permissions:
2020
actions: read
@@ -33,7 +33,7 @@ jobs:
3333

3434
dependency-review:
3535
if: github.event_name == 'pull_request'
36-
runs-on: ubuntu-latest
36+
runs-on: ubuntu-24.04
3737
timeout-minutes: 10
3838
permissions:
3939
contents: read

0 commit comments

Comments
 (0)