From 70162069deb3a817e0399edaea757f65158fa445 Mon Sep 17 00:00:00 2001 From: Charles Hofer Date: Thu, 14 Nov 2024 11:53:47 -0600 Subject: [PATCH 1/6] Get gh CLI auth status --- .github/workflows/rocm-nightly-upstream-sync.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml index e915ccba390d..cd4d4d44a8ae 100644 --- a/.github/workflows/rocm-nightly-upstream-sync.yml +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -14,7 +14,9 @@ jobs: contents: write runs-on: ubuntu-latest steps: - - run: gh repo sync rocm/jax -b main + - run: | + gh auth status + gh repo sync rocm/jax -b main env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} create-sync-branch: From 2eba48cc26bb90c9575e6c110efaaea962073e2f Mon Sep 17 00:00:00 2001 From: Charles Hofer Date: Thu, 14 Nov 2024 12:18:16 -0600 Subject: [PATCH 2/6] Change permissions --- .github/workflows/rocm-nightly-upstream-sync.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml index cd4d4d44a8ae..b2377c0c6a0b 100644 --- a/.github/workflows/rocm-nightly-upstream-sync.yml +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -6,23 +6,27 @@ on: workflow_dispatch: schedule: - cron: '0 6 * * 1-5' +permissions: + contents: write + pull-requests: write env: SYNC_BRANCH_NAME: ci-upstream-sync-${{ github.run_number }}_${{ github.run_attempt }} jobs: sync-main: - permissions: - contents: write + #permissions: + # contents: write runs-on: ubuntu-latest steps: - run: | gh auth status + gh repo view rocm/jax gh repo sync rocm/jax -b main env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} create-sync-branch: needs: sync-main - permissions: - contents: write + #permissions: + # contents: write runs-on: ubuntu-latest env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -37,8 +41,8 @@ jobs: git push origin HEAD open-sync-pr: needs: create-sync-branch - permissions: - pull-requests: write + #permissions: + # pull-requests: write runs-on: ubuntu-latest steps: - run: | From f8ba28ca4fa60ae0a7189cee500bca70e4a0b82a Mon Sep 17 00:00:00 2001 From: Charles Hofer Date: Thu, 14 Nov 2024 12:20:36 -0600 Subject: [PATCH 3/6] Remove unused repo view --- .github/workflows/rocm-nightly-upstream-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml index b2377c0c6a0b..89197c0f59df 100644 --- a/.github/workflows/rocm-nightly-upstream-sync.yml +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -19,7 +19,7 @@ jobs: steps: - run: | gh auth status - gh repo view rocm/jax + #gh repo view rocm/jax gh repo sync rocm/jax -b main env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0b49fb1d09648d339a16491e0bf2f68a3060fa0d Mon Sep 17 00:00:00 2001 From: Charles Hofer Date: Thu, 14 Nov 2024 12:44:33 -0600 Subject: [PATCH 4/6] Merge rocm-main into the CI branch to avoid running old CI code --- .github/workflows/rocm-nightly-upstream-sync.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml index 89197c0f59df..faca6c97aafb 100644 --- a/.github/workflows/rocm-nightly-upstream-sync.yml +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -13,20 +13,15 @@ env: SYNC_BRANCH_NAME: ci-upstream-sync-${{ github.run_number }}_${{ github.run_attempt }} jobs: sync-main: - #permissions: - # contents: write runs-on: ubuntu-latest steps: - run: | gh auth status - #gh repo view rocm/jax gh repo sync rocm/jax -b main env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} create-sync-branch: needs: sync-main - #permissions: - # contents: write runs-on: ubuntu-latest env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -38,11 +33,13 @@ jobs: git fetch git checkout origin/main git checkout -b $SYNC_BRANCH_NAME + # Try and merge rocm-main into this new branch so that we don't run upstream's CI code + git merge rocm-main || true + # If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts + git merge --abort || true git push origin HEAD open-sync-pr: needs: create-sync-branch - #permissions: - # pull-requests: write runs-on: ubuntu-latest steps: - run: | From 007f982d959e57cdf80461bf902eab2643fd9af2 Mon Sep 17 00:00:00 2001 From: Charles Hofer Date: Thu, 14 Nov 2024 13:30:07 -0600 Subject: [PATCH 5/6] Fix merge branch name --- .github/workflows/rocm-nightly-upstream-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml index faca6c97aafb..df5506c0617d 100644 --- a/.github/workflows/rocm-nightly-upstream-sync.yml +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -34,7 +34,7 @@ jobs: git checkout origin/main git checkout -b $SYNC_BRANCH_NAME # Try and merge rocm-main into this new branch so that we don't run upstream's CI code - git merge rocm-main || true + git merge origin/rocm-main || true # If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts git merge --abort || true git push origin HEAD From cb5f909259aa56eed47e5afa141b0741af29404c Mon Sep 17 00:00:00 2001 From: Charles Hofer Date: Thu, 14 Nov 2024 13:37:28 -0600 Subject: [PATCH 6/6] Add name and email for commit --- .github/workflows/rocm-nightly-upstream-sync.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rocm-nightly-upstream-sync.yml b/.github/workflows/rocm-nightly-upstream-sync.yml index df5506c0617d..57b0bdcc8b78 100644 --- a/.github/workflows/rocm-nightly-upstream-sync.yml +++ b/.github/workflows/rocm-nightly-upstream-sync.yml @@ -34,6 +34,8 @@ jobs: git checkout origin/main git checkout -b $SYNC_BRANCH_NAME # Try and merge rocm-main into this new branch so that we don't run upstream's CI code + git config --global user.email "github-actions@github.com" + git config --global user.name "GitHub Actions" git merge origin/rocm-main || true # If the merge creates conflicts, we want to abort and push to origin anyways so that a dev can resolve the conflicts git merge --abort || true