Skip to content

Commit 8607cb6

Browse files
authored
Make daily sync permissions at the workflow level and fix merge CI (#143)
1 parent 174f0b8 commit 8607cb6

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/rocm-nightly-upstream-sync.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@ on:
66
workflow_dispatch:
77
schedule:
88
- cron: '0 6 * * 1-5'
9+
permissions:
10+
contents: write
11+
pull-requests: write
912
env:
1013
SYNC_BRANCH_NAME: ci-upstream-sync-${{ github.run_number }}_${{ github.run_attempt }}
1114
jobs:
1215
sync-main:
13-
permissions:
14-
contents: write
1516
runs-on: ubuntu-latest
1617
steps:
17-
- run: gh repo sync rocm/jax -b main
18+
- run: |
19+
gh auth status
20+
gh repo sync rocm/jax -b main
1821
env:
1922
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2023
create-sync-branch:
2124
needs: sync-main
22-
permissions:
23-
contents: write
2425
runs-on: ubuntu-latest
2526
env:
2627
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -32,11 +33,15 @@ jobs:
3233
git fetch
3334
git checkout origin/main
3435
git checkout -b $SYNC_BRANCH_NAME
36+
# Try and merge rocm-main into this new branch so that we don't run upstream's CI code
37+
git config --global user.email "[email protected]"
38+
git config --global user.name "GitHub Actions"
39+
git merge origin/rocm-main || true
40+
# If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts
41+
git merge --abort || true
3542
git push origin HEAD
3643
open-sync-pr:
3744
needs: create-sync-branch
38-
permissions:
39-
pull-requests: write
4045
runs-on: ubuntu-latest
4146
steps:
4247
- run: |

0 commit comments

Comments
 (0)