diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 717fdf4..e97abec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d20799..b3cc857 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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