ci: read-only token for CI, and the release tag through the environment

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tobi Lütke
2026-09-25 14:27:16 +00:00
co-authored by Claude Opus 5.5
parent d37870cdea
commit 2ee640a448
2 changed files with 14 additions and 2 deletions
+4
View File
@@ -5,6 +5,10 @@ on:
branches: [main]
pull_request:
# Pull requests run here, so the token can read and nothing more.
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
+10 -2
View File
@@ -33,8 +33,12 @@ jobs:
- name: Version
id: version
# Through the environment, not spliced into the script: a tag typed
# into the dispatch form is text, never shell.
env:
TAG: ${{ inputs.tag || github.ref_name }}
run: |
tag="${{ inputs.tag || github.ref_name }}"
tag="$TAG"
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
if [ "$tag" != "v$version" ]; then
echo "tag $tag does not match Cargo.toml version $version" >&2
@@ -118,8 +122,12 @@ jobs:
- name: Version
id: version
# Through the environment, not spliced into the script: a tag typed
# into the dispatch form is text, never shell.
env:
TAG: ${{ inputs.tag || github.ref_name }}
run: |
tag="${{ inputs.tag || github.ref_name }}"
tag="$TAG"
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
if [ "$tag" != "v$version" ]; then
echo "tag $tag does not match Cargo.toml version $version" >&2