File tree 1 file changed +49
-0
lines changed
1 file changed +49
-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
+
19
+ - name : Install GitHub CLI
20
+ run : |
21
+ sudo apt update
22
+ sudo apt install gh -y
23
+
24
+ - name : Configure Git
25
+ run : |
26
+ git config --global user.email ${{ vars.BOT_EMAIL }}
27
+ git config --global user.name ${{ vars.BOT_USERNAME }}
28
+
29
+ - name : Authenticate GitHub CLI
30
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
31
+
32
+ - name : Update PR branches
33
+ run : |
34
+ prs=$(gh pr list --state open --base main --json number,headRefName -q '.[] | [.number, .headRefName] | @tsv')
35
+
36
+ while IFS=$'\t' read -r number branch; do
37
+ echo "Updating PR #$number (branch: $branch)"
38
+
39
+ git fetch origin "$branch"
40
+ git checkout "$branch"
41
+
42
+ if git merge origin/main --no-edit; then
43
+ git push origin HEAD:$branch
44
+ echo "✅ Updated $branch"
45
+ else
46
+ echo "❌ Merge conflict on $branch — skipped."
47
+ git merge --abort
48
+ fi
49
+ done <<< "$prs"
You can’t perform that action at this time.
0 commit comments