Skip to content

Commit 0695fcf

Browse files
authored
Merge pull request #20 from erdos-ai/fix/release-workflow-pr-instead-of-push
fix: create PR instead of pushing directly to main in release workflow
2 parents 8d9581b + 313336d commit 0695fcf

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: write
13+
pull-requests: write
1314

1415
jobs:
1516
goreleaser:
@@ -36,24 +37,29 @@ jobs:
3637
runs-on: ubuntu-latest
3738
steps:
3839
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 0
42+
- run: git fetch --force --tags
3943
- name: Make install script
4044
run: bash scripts/make-install.sh
41-
- name: Commit install script
45+
- name: Create PR for install script
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4248
run: |
4349
git config user.name github-actions
44-
git config user.email github-action@github.com
50+
git config user.email github-actions@github.com
4551
git add install.sh
46-
if ! git diff --staged --quiet; then
47-
git commit -m "chore: update install script for $(git describe --tags --abbrev=0) [skip ci]"
48-
echo "CHANGES_COMMITTED=true" >> $GITHUB_ENV
49-
else
50-
echo "No changes to commit"
51-
echo "CHANGES_COMMITTED=false" >> $GITHUB_ENV
52+
if git diff --staged --quiet; then
53+
echo "No changes to install script"
54+
exit 0
5255
fi
53-
- name: Push install script
54-
run: |
55-
if [ "$CHANGES_COMMITTED" = "true" ]; then
56-
git push origin HEAD:main
57-
else
58-
echo "No changes to push"
59-
fi
56+
TAG=$(git describe --tags --abbrev=0)
57+
BRANCH="chore/update-install-script-${TAG}"
58+
git checkout -b "$BRANCH"
59+
git commit -m "chore: update install script for ${TAG}"
60+
git push origin "$BRANCH"
61+
gh pr create \
62+
--title "chore: update install script for ${TAG}" \
63+
--body "Auto-generated PR to update install script after ${TAG} release." \
64+
--base main \
65+
--head "$BRANCH"

0 commit comments

Comments
 (0)