Skip to content

Commit 9701c40

Browse files
committed
chore(releases): automatically update the lockfile in changeset PRs
This is a step which we currently need to do manually and it's rather painful. The lockfile update is necessary due to cross references in our packages. Added it as a separate job instead of a step to start from fresh workspace, as the state that the `changeset` step leaves the workdir is not explicitly clear to the reader.
1 parent 331882f commit 9701c40

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,41 @@ jobs:
9494
VERSION=$(git show origin/changeset-release/main:packages/cli-v3/package.json | jq -r '.version')
9595
gh pr edit "$PR_NUMBER" --title "chore: release v$VERSION"
9696
fi
97+
98+
update-lockfile:
99+
name: Update lockfile on release PR
100+
runs-on: ubuntu-latest
101+
needs: release
102+
if: needs.release.outputs.published != 'true'
103+
permissions:
104+
contents: write
105+
steps:
106+
- name: Checkout release branch
107+
uses: actions/checkout@v4
108+
with:
109+
ref: changeset-release/main
110+
111+
- name: Setup pnpm
112+
uses: pnpm/action-setup@v4
113+
with:
114+
version: 10.23.0
115+
116+
- name: Setup node
117+
uses: buildjet/setup-node@v4
118+
with:
119+
node-version: 20.19.0
120+
121+
- name: Install and update lockfile
122+
run: pnpm install
123+
124+
- name: Commit and push lockfile
125+
run: |
126+
if git diff --quiet pnpm-lock.yaml; then
127+
echo "No lockfile changes"
128+
else
129+
git config user.name "github-actions[bot]"
130+
git config user.email "github-actions[bot]@users.noreply.github.com"
131+
git add pnpm-lock.yaml
132+
git commit -m "chore: update lockfile for release"
133+
git push
134+
fi

0 commit comments

Comments
 (0)