Skip to content

Commit 7959ccb

Browse files
fix: update-workflow
1 parent 078d0f0 commit 7959ccb

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/prepare-release-pr.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,30 @@ on:
88
jobs:
99
create-pull-request:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
1114
steps:
1215
- name: Checkout code
1316
uses: actions/checkout@v3
1417
with:
1518
fetch-depth: 0
19+
ref: master
20+
21+
- name: Check if main and master are different
22+
id: check-diff
23+
run: |
24+
git fetch origin main:main
25+
DIFF_COUNT=$(git rev-list --count main..master)
26+
echo "diff_count=$DIFF_COUNT" >> $GITHUB_OUTPUT
27+
if [ "$DIFF_COUNT" -gt 0 ]; then
28+
echo "Differences found between main and master. Will create PR."
29+
else
30+
echo "No differences found between main and master. Skipping PR creation."
31+
fi
1632
1733
- name: Create Pull Request
34+
if: steps.check-diff.outputs.diff_count > 0
1835
uses: peter-evans/create-pull-request@v5
1936
with:
2037
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)