diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index 36568ad..3867d0a 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -16,6 +16,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: + persist-credentials: false fetch-depth: 0 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 diff --git a/.github/workflows/cut-release.yml b/.github/workflows/cut-release.yml index f5be7c6..a9f8852 100644 --- a/.github/workflows/cut-release.yml +++ b/.github/workflows/cut-release.yml @@ -52,6 +52,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: token: ${{ steps.app-token.outputs.token }} + persist-credentials: true # release.sh pushes the branch / tag fetch-depth: 0 fetch-tags: true @@ -66,8 +67,9 @@ jobs: - name: Configure git identity env: GH_TOKEN: ${{ steps.app-token.outputs.token }} + APP_SLUG: ${{ steps.app-token.outputs.app-slug }} run: | - slug="${{ steps.app-token.outputs.app-slug }}[bot]" + slug="${APP_SLUG}[bot]" id="$(gh api "/users/${slug}" --jq .id)" git config user.name "$slug" git config user.email "${id}+${slug}@users.noreply.github.com" @@ -81,7 +83,10 @@ jobs: - name: Prepare release env: GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: ./scripts/release.sh prepare "${{ inputs.bump }}" + # Via env, not ${{ }} in the script: the input is free text and + # interpolating it into `run` would execute anything shell-shaped. + BUMP: ${{ inputs.bump }} + run: ./scripts/release.sh prepare "$BUMP" # Branch protection on main gates the merge on the checks and the # approving review, so this only merges once everything is green. @@ -115,6 +120,7 @@ jobs: with: ref: main token: ${{ steps.app-token.outputs.token }} + persist-credentials: true # release.sh pushes the branch / tag fetch-depth: 0 fetch-tags: true @@ -125,8 +131,9 @@ jobs: - name: Configure git identity env: GH_TOKEN: ${{ steps.app-token.outputs.token }} + APP_SLUG: ${{ steps.app-token.outputs.app-slug }} run: | - slug="${{ steps.app-token.outputs.app-slug }}[bot]" + slug="${APP_SLUG}[bot]" id="$(gh api "/users/${slug}" --jq .id)" git config user.name "$slug" git config user.email "${id}+${slug}@users.noreply.github.com" diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 6d457ba..30732c7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,6 +27,8 @@ jobs: private-key: ${{ secrets.HOTDATA_AUTOMATION_PRIVATE_KEY }} owner: hotdata-dev - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.12' @@ -70,6 +72,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.12' @@ -87,6 +91,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: python-version: '3.12' diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bbe0990..f78f600 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,6 +51,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: ref: ${{ env.RELEASE_TAG }} + persist-credentials: false - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 with: diff --git a/.github/workflows/regenerate.yml b/.github/workflows/regenerate.yml index 2780355..7e8469a 100644 --- a/.github/workflows/regenerate.yml +++ b/.github/workflows/regenerate.yml @@ -27,6 +27,8 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: token: ${{ steps.app-token.outputs.token }} + # create-pull-request authenticates its own push from `token`. + persist-credentials: false fetch-depth: 0 fetch-tags: true @@ -337,7 +339,8 @@ jobs: if: steps.cpr.outputs.pull-request-number env: GH_TOKEN: ${{ steps.app-token.outputs.token }} + PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} run: | - gh pr merge "${{ steps.cpr.outputs.pull-request-number }}" \ - --repo "${{ github.repository }}" \ + gh pr merge "$PR_NUMBER" \ + --repo "$GITHUB_REPOSITORY" \ --squash --auto diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 021cf81..465ddee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,6 +37,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: ref: ${{ env.RELEASE_TAG }} + persist-credentials: false fetch-depth: 0 - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6