Skip to content

Commit 4efa5c6

Browse files
committed
ci: harden release automation workflows
1 parent 3300fda commit 4efa5c6

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

.github/workflows/promote-develop-to-main.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ on:
2626
description: 'Integration branch to promote'
2727
required: true
2828
default: develop
29-
type: string
29+
type: choice
30+
options:
31+
- develop
3032
base_branch:
3133
description: 'Release branch that receives the promotion PR'
3234
required: true
3335
default: main
34-
type: string
36+
type: choice
37+
options:
38+
- main
3539
enable_auto_merge:
3640
description: 'Enable auto-merge for the promotion PR after checks pass'
3741
required: true
@@ -52,7 +56,7 @@ jobs:
5256
name: Open promotion PR
5357
runs-on: ubuntu-latest
5458
env:
55-
GH_TOKEN: ${{ secrets.RELEASE_AUTOMATION_TOKEN || github.token }}
59+
GH_TOKEN: ${{ github.token }}
5660
BASE_BRANCH: ${{ inputs.base_branch }}
5761
HEAD_BRANCH: ${{ inputs.head_branch }}
5862
steps:

.github/workflows/release-please.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,22 @@ jobs:
4242
tag_name: ${{ steps.release.outputs.tag_name }}
4343
version: ${{ steps.release.outputs.version }}
4444
steps:
45+
- name: Verify release automation token
46+
env:
47+
RELEASE_AUTOMATION_TOKEN: ${{ secrets.RELEASE_AUTOMATION_TOKEN }}
48+
run: |
49+
if [[ -z "${RELEASE_AUTOMATION_TOKEN}" ]]; then
50+
echo "RELEASE_AUTOMATION_TOKEN is required for release automation." >&2
51+
echo "Use a repository-scoped GitHub App token or fine-grained PAT." >&2
52+
echo "The token must create release tags that trigger downstream workflows." >&2
53+
exit 1
54+
fi
55+
4556
- name: Run release-please
4657
id: release
47-
uses: googleapis/release-please-action@v4
58+
uses: googleapis/release-please-action@8b8fd2cc23b2e18957157a9d923d75aa0c6f6ad5 # v4
4859
with:
49-
token: ${{ secrets.RELEASE_AUTOMATION_TOKEN || github.token }}
60+
token: ${{ secrets.RELEASE_AUTOMATION_TOKEN }}
5061
target-branch: main
5162
release-type: simple
5263

@@ -59,7 +70,6 @@ jobs:
5970
echo "- Tag: \`${{ steps.release.outputs.tag_name || 'not created' }}\`"
6071
echo "- Version: \`${{ steps.release.outputs.version || 'not created' }}\`"
6172
echo
62-
echo "Use a repository secret named \`RELEASE_AUTOMATION_TOKEN\` from a"
63-
echo "GitHub App or fine-grained PAT if tag or release events must"
64-
echo "trigger downstream workflows."
73+
echo "\`RELEASE_AUTOMATION_TOKEN\` is required so release-created tags"
74+
echo "can trigger downstream Docker image and bundle workflows."
6575
} >> "${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)