From e20c7fac6caa066e1faffe81a77b7752b7c260e4 Mon Sep 17 00:00:00 2001 From: frenzyfriday Date: Tue, 18 Mar 2025 09:08:29 +0100 Subject: [PATCH] [Test of] Adds GH action to sync branches --- .../workflows/sync_branches_periodically.yml | 12 ++++++ .../sync_branches_reusable_workflow.yml | 39 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/sync_branches_periodically.yml create mode 100644 .github/workflows/sync_branches_reusable_workflow.yml diff --git a/.github/workflows/sync_branches_periodically.yml b/.github/workflows/sync_branches_periodically.yml new file mode 100644 index 0000000000..3afb031a75 --- /dev/null +++ b/.github/workflows/sync_branches_periodically.yml @@ -0,0 +1,12 @@ +--- +name: Periodically sync branches +on: + schedule: + - cron: '0 21 * * 1' + +jobs: + trigger_sync: + uses: openstack-k8s-operators/ci-framework/.github/workflows/sync_branches_reusable_workflow.yml@main + with: + main-branch: main + follower-branch: ananya-do-not-use-tmp diff --git a/.github/workflows/sync_branches_reusable_workflow.yml b/.github/workflows/sync_branches_reusable_workflow.yml new file mode 100644 index 0000000000..4171dd5c6b --- /dev/null +++ b/.github/workflows/sync_branches_reusable_workflow.yml @@ -0,0 +1,39 @@ +--- +name: Sync a follower branch with Main +on: + workflow_call: + inputs: + main-branch: + required: true + type: string + follower-branch: + required: true + type: string + +jobs: + sync: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Checkout main branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: + ${{ inputs.main-branch }} + + - name: Checkout, rebase and push to follower branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: + ${{ inputs.follower-branch }} + - run: | + # Details about the GH action bot comes from + # https://api.github.com/users/github-actions%5Bbot%5D + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git rebase origin/${{ inputs.main-branch }} + git push origin ${{ inputs.follower-branch }}