From bd22af4045659b194922c6c5baf9c53de3cd8c17 Mon Sep 17 00:00:00 2001 From: Kirill Ivanov Date: Tue, 23 Jul 2024 14:30:01 +1200 Subject: [PATCH 1/4] chore: update runner tags, as self-hopsted runners are not available in mattrglobal --- .github/workflows/github_clone_assurance.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/github_clone_assurance.yaml b/.github/workflows/github_clone_assurance.yaml index 1043e911..5afaf0fe 100644 --- a/.github/workflows/github_clone_assurance.yaml +++ b/.github/workflows/github_clone_assurance.yaml @@ -8,9 +8,10 @@ on: jobs: MirrorRepoToMATTRAssurance: - runs-on: ["self-hosted", "engineering", "Linux", "X64"] + runs-on: ubuntu-latest permissions: contents: read + id-token: write steps: - name: mirror repo uses: mattrinternal/sre-reusable-action/actions/github-clone-assurance@master From 6fd262977880ccd299e78c73472a1b3251018b26 Mon Sep 17 00:00:00 2001 From: Kirill Ivanov Date: Wed, 24 Jul 2024 13:47:53 +1200 Subject: [PATCH 2/4] chore: use script directly instead of reusable action --- .github/workflows/github_clone_assurance.yaml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/github_clone_assurance.yaml b/.github/workflows/github_clone_assurance.yaml index 5afaf0fe..b4475e98 100644 --- a/.github/workflows/github_clone_assurance.yaml +++ b/.github/workflows/github_clone_assurance.yaml @@ -14,11 +14,14 @@ jobs: id-token: write steps: - name: mirror repo - uses: mattrinternal/sre-reusable-action/actions/github-clone-assurance@master - with: - github_repository: ${{ env.GITHUB_REPOSITORY }} - github_ref_name: ${{ env.GITHUB_REF_NAME }} - remote_git_user_name: ${{ secrets.MATTRASSURANCE_GIT_USER_NAME }} - remote_git_user_email: ${{ secrets.MATTRASSURANCE_GIT_USER_EMAIL }} - remote_git_user_pat: ${{ secrets.MATTRASSURANCE_GIT_USER_PAT }} - remote_git_repo: 'mattrassurance/pairing_crypto' + shell: bash + run: | + rm -r .git + rm -r .github + git init --initial-branch=${{ env.GITHUB_REF_NAME }} + git config --local user.name ${{ secrets.MATTRASSURANCE_GIT_USER_NAME }} + git config --local user.email ${{ secrets.MATTRASSURANCE_GIT_USER_EMAIL }} + git add . + git commit -m "Backing up ${{ env.GITHUB_REPOSITORY }} to mattrassurance org" + git remote add origin https://${{ secrets.MATTRASSURANCE_GIT_USER_NAME }}:${{ secrets.MATTRASSURANCE_GIT_USER_PAT }}@github.com/mattrassurance/pairing_crypto.git + git push origin ${{ env.GITHUB_REF_NAME }} --force From 4745dea968d4189b93058e28bc167fa6c7650611 Mon Sep 17 00:00:00 2001 From: Kirill Ivanov Date: Wed, 24 Jul 2024 15:39:28 +1200 Subject: [PATCH 3/4] chore: add checkout step to assurance workflow --- .github/workflows/github_clone_assurance.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/github_clone_assurance.yaml b/.github/workflows/github_clone_assurance.yaml index b4475e98..68aa1e9f 100644 --- a/.github/workflows/github_clone_assurance.yaml +++ b/.github/workflows/github_clone_assurance.yaml @@ -13,6 +13,9 @@ jobs: contents: read id-token: write steps: + - name: Checkout + uses: actions/checkout@v4 + - name: mirror repo shell: bash run: | From 4979ee4df8244ce60fcc27edd367c83c7428a5a9 Mon Sep 17 00:00:00 2001 From: Kirill Ivanov Date: Wed, 24 Jul 2024 21:44:40 +1200 Subject: [PATCH 4/4] chore: fix workflow variables --- .github/workflows/github_clone_assurance.yaml | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/github_clone_assurance.yaml b/.github/workflows/github_clone_assurance.yaml index 68aa1e9f..e2e4374a 100644 --- a/.github/workflows/github_clone_assurance.yaml +++ b/.github/workflows/github_clone_assurance.yaml @@ -15,16 +15,22 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - + - name: mirror repo + env: + GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }} + GITHUB_REF_NAME: ${{ env.GITHUB_REF_NAME }} + REMOTE_GIT_USER_NAME: ${{ secrets.MATTRASSURANCE_GIT_USER_NAME }} + REMOTE_GIT_USER_EMAIL: ${{ secrets.MATTRASSURANCE_GIT_USER_EMAIL }} + REMOTE_GIT_USER_PAT: ${{ secrets.MATTRASSURANCE_GIT_USER_PAT }} shell: bash run: | rm -r .git rm -r .github - git init --initial-branch=${{ env.GITHUB_REF_NAME }} - git config --local user.name ${{ secrets.MATTRASSURANCE_GIT_USER_NAME }} - git config --local user.email ${{ secrets.MATTRASSURANCE_GIT_USER_EMAIL }} + git init --initial-branch=${GITHUB_REF_NAME} + git config --local user.name ${REMOTE_GIT_USER_NAME} + git config --local user.email ${REMOTE_GIT_USER_EMAIL} git add . - git commit -m "Backing up ${{ env.GITHUB_REPOSITORY }} to mattrassurance org" - git remote add origin https://${{ secrets.MATTRASSURANCE_GIT_USER_NAME }}:${{ secrets.MATTRASSURANCE_GIT_USER_PAT }}@github.com/mattrassurance/pairing_crypto.git - git push origin ${{ env.GITHUB_REF_NAME }} --force + git commit -m "Backing up ${GITHUB_REPOSITORY} to mattrassurance org" + git remote add origin https://${REMOTE_GIT_USER_NAME}:${REMOTE_GIT_USER_PAT}@github.com/mattrassurance/pairing_crypto.git + git push origin ${GITHUB_REF_NAME} --force