Skip to content

Commit 1c29ef4

Browse files
authored
fix(ci): handle workflows publishing issue (#67)
1 parent 009160c commit 1c29ef4

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
branches:
66
- main
77
workflow_dispatch:
8+
inputs:
9+
message:
10+
type: string
11+
description: 'Overrides the publish commit subject. A publish is a snapshot, so when several commits piled up since the last run the newest subject alone undersells them.'
12+
required: false
13+
default: ''
814

915
permissions: {}
1016

@@ -17,10 +23,15 @@ jobs:
1723
runs-on: ubuntu-slim
1824
environment: release-branch
1925
permissions:
20-
contents: write
26+
contents: read
2127
steps:
2228
- name: Checkout code
2329
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
30+
with:
31+
# GITHUB_TOKEN cannot create or update files under .github/workflows --
32+
# the `workflows` permission is not grantable to it. The release branch
33+
# carries repository-check.yml, so the push needs a PAT that has it.
34+
token: ${{ secrets.RELEASE_BRANCH_TOKEN }}
2435

2536
- name: Setup PNPM
2637
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
@@ -41,6 +52,7 @@ jobs:
4152
env:
4253
BRANCH: release
4354
SHA: ${{ github.sha }}
55+
MESSAGE: ${{ inputs.message }}
4456
GIT_USER_NAME: ${{ github.actor }}
4557
GIT_USER_EMAIL: ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
4658
WORKFLOW_FILES: repository-check.yml

‎scripts/publish-actions.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if git diff --cached --quiet; then
5353
fi
5454

5555
# $SHA must already be a resolved commit hash, not a ref like "HEAD"
56-
git -c user.name="$GIT_USER_NAME" -c user.email="$GIT_USER_EMAIL" commit -m "publish: $(git log -1 --format=%s "$SHA")"
56+
git -c user.name="$GIT_USER_NAME" -c user.email="$GIT_USER_EMAIL" commit -m "publish: ${MESSAGE:-$(git log -1 --format=%s "$SHA")}"
5757
git push origin "$BRANCH"
5858

5959
# An empty $TAGS would otherwise turn `git push origin --force $TAGS` into

0 commit comments

Comments
 (0)