Skip to content

Commit 68d4e8d

Browse files
committed
fix: bumper workflow lockfile errors on generated PR
1 parent f0c773d commit 68d4e8d

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/version-bump.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ permissions:
1414
contents: write
1515
pull-requests: write
1616

17+
env:
18+
NODE_VERSION: 22
19+
1720
concurrency:
1821
group: version-bump-${{ github.event.milestone.number || github.run_id }}
1922
cancel-in-progress: false
@@ -35,7 +38,7 @@ jobs:
3538
- name: Setup Node
3639
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
3740
with:
38-
node-version: '24'
41+
node-version: ${{ env.NODE_VERSION }}
3942

4043
- name: Resolve version
4144
id: version
@@ -77,6 +80,25 @@ jobs:
7780
VERSION: ${{ steps.version.outputs.version }}
7881
run: npm version "$VERSION" --no-git-tag-version --allow-same-version
7982

83+
- name: Sync git-proxy-cli's pin on the root package
84+
env:
85+
VERSION: ${{ steps.version.outputs.version }}
86+
run: |
87+
node -e '
88+
const fs = require("fs");
89+
const p = "packages/git-proxy-cli/package.json";
90+
const pkg = JSON.parse(fs.readFileSync(p, "utf8"));
91+
if (!pkg.dependencies || !pkg.dependencies["@finos/git-proxy"]) {
92+
console.error("::error::Expected @finos/git-proxy in git-proxy-cli dependencies.");
93+
process.exit(1);
94+
}
95+
pkg.dependencies["@finos/git-proxy"] = process.env.VERSION;
96+
fs.writeFileSync(p, JSON.stringify(pkg, null, 2) + "\n");
97+
'
98+
99+
- name: Refresh the lockfile
100+
run: npm install --package-lock-only --no-audit --no-fund
101+
80102
- name: Open version bump PR
81103
env:
82104
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -93,15 +115,15 @@ jobs:
93115
git checkout -b "$BRANCH"
94116
git add package.json package-lock.json packages/git-proxy-cli/package.json
95117
git commit -m "chore: bump git-proxy and git-proxy-cli to $VERSION"
96-
git push -u origin "$BRANCH" --force
118+
git push -u origin "$BRANCH" --force-with-lease
97119
98120
if [ -n "$MILESTONE_URL" ]; then
99121
SOURCE_LINE="Triggered by closing milestone **$MILESTONE_TITLE** ($MILESTONE_URL)."
100122
else
101123
SOURCE_LINE="Triggered manually for version $VERSION."
102124
fi
103125
104-
BODY=$(printf '%s\n\nBumps:\n- `package.json`, `package-lock.json`\n- `packages/git-proxy-cli/package.json`\n\nOnce merged, cut `%s` from `main` per our [release process](https://git-proxy.finos.org/docs/development/releases) in order to generate a GitHub draft release.\n' "$SOURCE_LINE" "$RELEASE_BRANCH")
126+
BODY=$(printf '%s\n\nBumps:\n- `package.json`, `package-lock.json`\n- `packages/git-proxy-cli/package.json` (including its pin on `@finos/git-proxy`)\n\nOnce merged, cut `%s` from `main` per our [release process](https://git-proxy.finos.org/docs/development/releases) in order to generate a GitHub draft release.\n' "$SOURCE_LINE" "$RELEASE_BRANCH")
105127
106128
if gh pr view "$BRANCH" >/dev/null 2>&1; then
107129
echo "PR for $BRANCH already exists. Branch updated, no new PR opened."

0 commit comments

Comments
 (0)