File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : PR Auto Updater
2+ on :
3+ push :
4+ branches :
5+ - ' main'
6+ - ' release/*'
7+ tags-ignore :
8+ - ' *'
9+
10+ jobs :
11+ pr-autoupdate :
12+ runs-on : ubuntu-22.04
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v4
16+ with :
17+ fetch-depth : 0
18+ token : ${{ secrets.BOT_TOKEN }}
19+
20+ - name : Install GitHub CLI
21+ run : |
22+ sudo apt update
23+ sudo apt install gh -y
24+
25+ - name : Configure Git
26+ run : |
27+ git config --global user.email ${{ vars.BOT_EMAIL }}
28+ git config --global user.name ${{ vars.BOT_USERNAME }}
29+
30+ - name : Update PR branches
31+ env :
32+ GH_TOKEN : ${{ secrets.BOT_TOKEN }}
33+ GH_PROMPT_DISABLED : 1
34+ run : |
35+ prs=$(gh pr list --state open --base main --json number,headRefName -q '.[] | [.number, .headRefName] | @tsv')
36+
37+ while IFS=$'\t' read -r number branch; do
38+ echo "Updating PR #$number (branch: $branch)"
39+
40+ git fetch origin "$branch"
41+ git checkout "$branch"
42+
43+ if git merge origin/main --no-edit; then
44+ git push origin HEAD:$branch
45+ echo "✅ Updated $branch"
46+ else
47+ echo "❌ Merge conflict on $branch — skipped."
48+ git merge --abort
49+ fi
50+ done <<< "$prs"
You can’t perform that action at this time.
0 commit comments