Skip to content

Commit 3a5976c

Browse files
authored
fix(release-please): fix PR titles and auto-update lockfiles (#474)
* fix(release-please): use static scope to avoid whitespace bug Release-please has a bug where it inserts an extra space before the component name when using ${component} in the scope position of the pull-request-title-pattern, resulting in titles like: chore( dotprompt-codemirror): release 0.1.1 Change the pattern to use a static 'release' scope and put the component in the description instead: chore(release): dotprompt-codemirror 0.1.1 * fix(ci): disable broken update-lockfiles job for separate PRs The update-lockfiles job was designed for combined release PRs but we use separate-pull-requests: true. With separate PRs, the 'pr' output is not set (only 'prs' array is set), so the job condition was never true. Disable the job for now until we rework it to handle separate PRs properly. * fix(ci): auto-update Python lockfiles for release-please PRs When a release-please PR bumps the version in pyproject.toml, the uv.lock file becomes out of sync. This change detects release-please PRs (branches starting with 'release-please--') and automatically updates the lockfiles before running the check. The workflow will: 1. Detect if the PR is from release-please 2. Run 'uv lock' and export requirements 3. Commit and push the updated lockfiles 4. Then run the normal lockfile verification * fix(ci): auto-update maven_install.json for release-please PRs Similar to the Python lockfile fix, this updates the Bazel workflow to automatically commit maven_install.json changes when running on a release-please PR branch. The workflow will: 1. Detect if the PR is from release-please 2. Run 'bazelisk run @maven//:pin' as before 3. For release-please PRs: commit and push the updated maven_install.json 4. For regular PRs: fail if maven_install.json was modified (existing behavior) * fix(ci): add lockfile checks for Rust, JS, and Go workflows Add lockfile verification to all language workflows with automatic updates for release-please PRs: **Rust workflow:** - Add cargo-lock-check job that runs 'cargo check --locked' - Auto-update Cargo.lock for release-please PRs via 'cargo update' **JS workflow:** - Add pnpm-lock-check job that runs 'pnpm install --frozen-lockfile' - Auto-update pnpm-lock.yaml for release-please PRs - Expand path triggers to include packages/** and pnpm files **Go workflow:** - Add go-mod-tidy-check job that verifies go.mod/go.sum are tidy - Auto-update go.sum for release-please PRs via 'go mod tidy' All workflows now follow the same pattern: 1. Detect if PR is from release-please (branch starts with release-please--) 2. For release-please PRs: update lockfiles and commit/push 3. Verify lockfiles are up to date (fails for regular PRs if outdated)
1 parent d60bbf0 commit 3a5976c

File tree

7 files changed

+257
-10
lines changed

7 files changed

+257
-10
lines changed

.github/workflows/bazel.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ on:
2222
pull_request:
2323
branches: [ main ]
2424

25-
permissions: read-all # Needed for security checks, adjust if necessary
25+
permissions:
26+
contents: write
27+
pull-requests: write
2628

2729
jobs:
2830
build_and_test:
@@ -37,6 +39,9 @@ jobs:
3739
steps:
3840
- name: Checkout Code
3941
uses: actions/checkout@v6
42+
with:
43+
ref: ${{ github.head_ref }}
44+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
4045

4146
# Bazel needs a JDK. Setup Java from matrix.
4247
- name: Setup Java JDK ${{ matrix.java-version }}
@@ -77,10 +82,34 @@ jobs:
7782
bazel-action-${{ github.ref }}-${{ hashFiles('**/MODULE.bazel.lock', '**/maven_install.json', '**/pnpm-lock.yaml') }}
7883
bazel-action-
7984
85+
- name: Check if this is a release-please PR
86+
id: check-release-please
87+
run: |
88+
if [[ "${{ github.head_ref }}" == release-please--* ]]; then
89+
echo "is_release_please=true" >> $GITHUB_OUTPUT
90+
else
91+
echo "is_release_please=false" >> $GITHUB_OUTPUT
92+
fi
93+
8094
- name: Pin Java dependencies
8195
run: bazelisk run @maven//:pin
8296

97+
- name: Commit maven_install.json updates for release-please PR
98+
if: steps.check-release-please.outputs.is_release_please == 'true' && matrix.java-version == 17
99+
run: |
100+
git config user.name "github-actions[bot]"
101+
git config user.email "github-actions[bot]@users.noreply.github.com"
102+
if ! git diff --quiet maven_install.json; then
103+
git add maven_install.json
104+
git commit -m "chore: update maven_install.json"
105+
git push
106+
echo "maven_install.json updated and pushed"
107+
else
108+
echo "No maven_install.json changes needed"
109+
fi
110+
83111
- name: Check for changes in maven_install.json
112+
if: steps.check-release-please.outputs.is_release_please != 'true'
84113
id: git-check
85114
run: |
86115
if [[ -n "$(git status --porcelain maven_install.json)" ]]; then

.github/workflows/go.yml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
pull_request:
2121
branches: [ main ]
2222

23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
2327
jobs:
2428
check-paths:
2529
runs-on: ubuntu-latest
@@ -38,6 +42,64 @@ jobs:
3842
spec/**
3943
.github/workflows/go.yml
4044
45+
go-mod-tidy-check:
46+
needs: check-paths
47+
if: needs.check-paths.outputs.any_changed == 'true'
48+
runs-on: ubuntu-latest
49+
name: go.sum Check
50+
steps:
51+
- name: Checkout Repo
52+
uses: actions/checkout@v6
53+
with:
54+
ref: ${{ github.head_ref }}
55+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
56+
57+
- name: Set up Go
58+
uses: actions/setup-go@v6
59+
with:
60+
go-version: stable
61+
62+
- name: Check if this is a release-please PR
63+
id: check-release-please
64+
run: |
65+
if [[ "${{ github.head_ref }}" == release-please--* ]]; then
66+
echo "is_release_please=true" >> $GITHUB_OUTPUT
67+
else
68+
echo "is_release_please=false" >> $GITHUB_OUTPUT
69+
fi
70+
71+
- name: Update go.sum for release-please PR
72+
if: steps.check-release-please.outputs.is_release_please == 'true'
73+
working-directory: go
74+
run: |
75+
echo "Updating go.sum for release-please PR..."
76+
go mod tidy
77+
78+
- name: Commit go.sum updates
79+
if: steps.check-release-please.outputs.is_release_please == 'true'
80+
run: |
81+
git config user.name "github-actions[bot]"
82+
git config user.email "github-actions[bot]@users.noreply.github.com"
83+
if ! git diff --quiet go/go.sum go/go.mod; then
84+
git add go/go.sum go/go.mod
85+
git commit -m "chore: update go.mod and go.sum"
86+
git push
87+
echo "go.sum updated and pushed"
88+
else
89+
echo "No go.sum changes needed"
90+
fi
91+
92+
- name: Check go.mod and go.sum are tidy
93+
working-directory: go
94+
run: |
95+
go mod tidy
96+
if ! git diff --quiet go.sum go.mod; then
97+
echo "❌ go.mod or go.sum is not tidy. Run 'go mod tidy' in the go/ directory."
98+
git diff go.sum go.mod
99+
exit 1
100+
fi
101+
echo "✅ go.mod and go.sum are tidy"
102+
41103
format-check:
42104
needs: check-paths
43105
if: needs.check-paths.outputs.any_changed == 'true'
@@ -97,12 +159,12 @@ jobs:
97159

98160
go-checks-all:
99161
if: always()
100-
needs: [format-check, tests]
162+
needs: [go-mod-tidy-check, format-check, tests]
101163
runs-on: ubuntu-latest
102164
steps:
103165
- name: Check overall status
104166
run: |
105-
if [[ "${{ needs.format-check.result }}" == "failure" || "${{ needs.tests.result }}" == "failure" ]]; then
167+
if [[ "${{ needs.go-mod-tidy-check.result }}" == "failure" || "${{ needs.format-check.result }}" == "failure" || "${{ needs.tests.result }}" == "failure" ]]; then
106168
echo "Go checks failed"
107169
exit 1
108170
fi

.github/workflows/js.yml

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
pull_request:
2121
branches: [ main ]
2222

23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
2327
jobs:
2428
check-paths:
2529
runs-on: ubuntu-latest
@@ -36,8 +40,66 @@ jobs:
3640
files: |
3741
js/**
3842
spec/**
43+
packages/**
44+
pnpm-lock.yaml
45+
pnpm-workspace.yaml
3946
.github/workflows/js.yml
4047
48+
pnpm-lock-check:
49+
needs: check-paths
50+
if: needs.check-paths.outputs.any_changed == 'true'
51+
runs-on: ubuntu-latest
52+
name: pnpm-lock.yaml Check
53+
steps:
54+
- uses: actions/checkout@v6
55+
with:
56+
ref: ${{ github.head_ref }}
57+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
58+
59+
- name: Setup Node.js
60+
uses: actions/setup-node@v6
61+
with:
62+
node-version: "22"
63+
64+
- name: Install pnpm
65+
uses: pnpm/action-setup@v2
66+
with:
67+
version: 10
68+
69+
- name: Check if this is a release-please PR
70+
id: check-release-please
71+
run: |
72+
if [[ "${{ github.head_ref }}" == release-please--* ]]; then
73+
echo "is_release_please=true" >> $GITHUB_OUTPUT
74+
else
75+
echo "is_release_please=false" >> $GITHUB_OUTPUT
76+
fi
77+
78+
- name: Update lockfiles for release-please PR
79+
if: steps.check-release-please.outputs.is_release_please == 'true'
80+
run: |
81+
echo "Updating pnpm-lock.yaml for release-please PR..."
82+
pnpm install --lockfile-only
83+
84+
- name: Commit lockfile updates
85+
if: steps.check-release-please.outputs.is_release_please == 'true'
86+
run: |
87+
git config user.name "github-actions[bot]"
88+
git config user.email "github-actions[bot]@users.noreply.github.com"
89+
if ! git diff --quiet pnpm-lock.yaml js/pnpm-lock.yaml; then
90+
git add pnpm-lock.yaml js/pnpm-lock.yaml 2>/dev/null || true
91+
git commit -m "chore: update pnpm lockfiles" || echo "No changes to commit"
92+
git push || echo "Nothing to push"
93+
echo "Lockfiles updated and pushed"
94+
else
95+
echo "No lockfile changes needed"
96+
fi
97+
98+
- name: Check pnpm-lock.yaml is up to date
99+
run: |
100+
pnpm install --frozen-lockfile
101+
echo "✅ pnpm-lock.yaml is up to date"
102+
41103
format-check:
42104
needs: check-paths
43105
if: needs.check-paths.outputs.any_changed == 'true'
@@ -100,12 +162,12 @@ jobs:
100162

101163
js-checks-all:
102164
if: always()
103-
needs: [format-check, test]
165+
needs: [pnpm-lock-check, format-check, test]
104166
runs-on: ubuntu-latest
105167
steps:
106168
- name: Check overall status
107169
run: |
108-
if [[ "${{ needs.format-check.result }}" == "failure" || "${{ needs.test.result }}" == "failure" ]]; then
170+
if [[ "${{ needs.pnpm-lock-check.result }}" == "failure" || "${{ needs.format-check.result }}" == "failure" || "${{ needs.test.result }}" == "failure" ]]; then
109171
echo "JS checks failed"
110172
exit 1
111173
fi

.github/workflows/python.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,53 @@ jobs:
4242
needs: check-paths
4343
if: needs.check-paths.outputs.any_changed == 'true'
4444
runs-on: ubuntu-latest
45+
permissions:
46+
contents: write
47+
pull-requests: write
4548
steps:
4649
- uses: actions/checkout@v6
50+
with:
51+
# Use the PR head ref to allow pushing back to the branch
52+
ref: ${{ github.head_ref }}
53+
# Use a token that can push to the branch (for release-please PRs)
54+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
4755

4856
- name: Install uv
4957
uses: astral-sh/setup-uv@v5
5058
with:
5159
enable-cache: true
5260

61+
- name: Check if this is a release-please PR
62+
id: check-release-please
63+
run: |
64+
if [[ "${{ github.head_ref }}" == release-please--* ]]; then
65+
echo "is_release_please=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "is_release_please=false" >> $GITHUB_OUTPUT
68+
fi
69+
70+
- name: Update lockfiles for release-please PR
71+
if: steps.check-release-please.outputs.is_release_please == 'true'
72+
working-directory: python
73+
run: |
74+
echo "Updating uv.lock for release-please PR..."
75+
uv lock
76+
../scripts/export_requirements
77+
78+
- name: Commit lockfile updates
79+
if: steps.check-release-please.outputs.is_release_please == 'true'
80+
run: |
81+
git config user.name "github-actions[bot]"
82+
git config user.email "github-actions[bot]@users.noreply.github.com"
83+
if ! git diff --quiet python/uv.lock python/requirements.txt; then
84+
git add python/uv.lock python/requirements.txt
85+
git commit -m "chore: update Python lockfiles"
86+
git push
87+
echo "Lockfiles updated and pushed"
88+
else
89+
echo "No lockfile changes needed"
90+
fi
91+
5392
- name: Check uv.lock is up to date
5493
working-directory: python
5594
run: |

.github/workflows/release-please.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ jobs:
4545
update-lockfiles:
4646
runs-on: ubuntu-latest
4747
needs: release-please
48-
# Run when release-please creates/updates a PR (not when releases are created)
49-
if: ${{ needs.release-please.outputs.pr != '' && needs.release-please.outputs.releases_created != 'true' }}
48+
# DISABLED: This job was designed for combined PRs but we use separate-pull-requests: true
49+
# The 'pr' output is not set when using separate PRs (only 'prs' array is set).
50+
# TODO: Rework this to handle separate PRs or switch to combined PRs.
51+
if: false
5052
steps:
5153
- uses: actions/checkout@v6
5254
with:

.github/workflows/rust.yml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
pull_request:
2121
branches: [ main ]
2222

23+
permissions:
24+
contents: write
25+
pull-requests: write
26+
2327
jobs:
2428
check-paths:
2529
runs-on: ubuntu-latest
@@ -39,6 +43,55 @@ jobs:
3943
Cargo.lock
4044
.github/workflows/rust.yml
4145
46+
cargo-lock-check:
47+
needs: check-paths
48+
if: needs.check-paths.outputs.any_changed == 'true'
49+
name: Cargo.lock Check
50+
runs-on: ubuntu-latest
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v6
54+
with:
55+
ref: ${{ github.head_ref }}
56+
token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }}
57+
58+
- name: Install Rust toolchain
59+
uses: dtolnay/rust-toolchain@stable
60+
61+
- name: Check if this is a release-please PR
62+
id: check-release-please
63+
run: |
64+
if [[ "${{ github.head_ref }}" == release-please--* ]]; then
65+
echo "is_release_please=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "is_release_please=false" >> $GITHUB_OUTPUT
68+
fi
69+
70+
- name: Update Cargo.lock for release-please PR
71+
if: steps.check-release-please.outputs.is_release_please == 'true'
72+
run: |
73+
echo "Updating Cargo.lock for release-please PR..."
74+
cargo update --workspace
75+
76+
- name: Commit Cargo.lock updates
77+
if: steps.check-release-please.outputs.is_release_please == 'true'
78+
run: |
79+
git config user.name "github-actions[bot]"
80+
git config user.email "github-actions[bot]@users.noreply.github.com"
81+
if ! git diff --quiet Cargo.lock; then
82+
git add Cargo.lock
83+
git commit -m "chore: update Cargo.lock"
84+
git push
85+
echo "Cargo.lock updated and pushed"
86+
else
87+
echo "No Cargo.lock changes needed"
88+
fi
89+
90+
- name: Check Cargo.lock is up to date
91+
run: |
92+
cargo check --locked --workspace
93+
echo "✅ Cargo.lock is up to date"
94+
4295
format-check:
4396
needs: check-paths
4497
if: needs.check-paths.outputs.any_changed == 'true'
@@ -131,12 +184,12 @@ jobs:
131184

132185
rust-checks-all:
133186
if: always()
134-
needs: [format-check, clippy-lint, check-build-test]
187+
needs: [cargo-lock-check, format-check, clippy-lint, check-build-test]
135188
runs-on: ubuntu-latest
136189
steps:
137190
- name: Check overall status
138191
run: |
139-
if [[ "${{ needs.format-check.result }}" == "failure" || "${{ needs.clippy-lint.result }}" == "failure" || "${{ needs.check-build-test.result }}" == "failure" ]]; then
192+
if [[ "${{ needs.cargo-lock-check.result }}" == "failure" || "${{ needs.format-check.result }}" == "failure" || "${{ needs.clippy-lint.result }}" == "failure" || "${{ needs.check-build-test.result }}" == "failure" ]]; then
140193
echo "Rust checks failed"
141194
exit 1
142195
fi

.release-please-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"prerelease": false,
77
"include-component-in-tag": true,
88
"include-v-in-tag": false,
9-
"pull-request-title-pattern": "chore(${component}): release ${version}",
9+
"pull-request-title-pattern": "chore(release): ${component} ${version}",
1010
"separate-pull-requests": true,
1111
"skip-github-release": false,
1212
"plugins": ["node-workspace"],

0 commit comments

Comments
 (0)