From 0252ddfa7695bdd9228c51e96770161ec49eeb19 Mon Sep 17 00:00:00 2001 From: "Illuminatus [CCIO]" Date: Sat, 27 Apr 2024 13:24:37 -0700 Subject: [PATCH] Workflows to rebase preview and sanchonet branches on push to alpha, or workflow dispatch. --- .github/workflows/rebase-preview.yml | 38 ++++++++++++++++++++++++++ .github/workflows/rebase-sanchonet.yml | 38 ++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/rebase-preview.yml create mode 100644 .github/workflows/rebase-sanchonet.yml diff --git a/.github/workflows/rebase-preview.yml b/.github/workflows/rebase-preview.yml new file mode 100644 index 000000000..c140cd513 --- /dev/null +++ b/.github/workflows/rebase-preview.yml @@ -0,0 +1,38 @@ +name: Rebase preview branch +on: + workflow_dispatch: + push: + branches: + - alpha + +jobs: + rebase: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: preview + fetch-depth: 0 + - name: Configure Git + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + echo "GitHub Actor: ${GITHUB_ACTOR}" >> "$GITHUB_STEP_SUMMARY" + echo "GitHub Email: ${GITHUB_ACTOR}@users.noreply.github.com" >> "$GITHUB_STEP_SUMMARY" + - name: Fetch alpha + run: | + git fetch origin alpha + - name: Get current SHA + run: | + echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Rebase on alpha + run: | + git rebase origin/alpha + - name: Check for changes + id: git-check + run: | + export MODIFIED=$([ "$(git rev-parse HEAD)" != "$(jq -r '.sha' "$GITHUB_OUTPUT")" ] && echo "true" || echo "false") + echo "MODIFIED=${MODIFIED}" >> "$GITHUB_OUTPUT" + - name: Push changes + if: steps.git-check.outputs.MODIFIED == 'true' + run: git push --force-with-lease diff --git a/.github/workflows/rebase-sanchonet.yml b/.github/workflows/rebase-sanchonet.yml new file mode 100644 index 000000000..8b846a469 --- /dev/null +++ b/.github/workflows/rebase-sanchonet.yml @@ -0,0 +1,38 @@ +name: Rebase sanchonet branch +on: + workflow_dispatch: + push: + branches: + - alpha +jobs: + rebase: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: sanchonet + fetch-depth: 0 + - name: Configure Git + run: | + git config --global user.name "${GITHUB_ACTOR}" + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + echo "GitHub Actor: ${GITHUB_ACTOR}" >> "$GITHUB_STEP_SUMMARY" + echo "GitHub Email: ${GITHUB_ACTOR}@users.noreply.github.com" >> "$GITHUB_STEP_SUMMARY" + - name: Fetch alpha + run: | + git fetch origin alpha + - name: Get current SHA + run: | + echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Rebase on alpha + run: | + git rebase origin/alpha + - name: Check for changes + id: git-check + run: | + export MODIFIED=$([ "$(git rev-parse HEAD)" != "$(jq -r '.sha' "$GITHUB_OUTPUT")" ] && echo "true" || echo "false") + echo "MODIFIED=${MODIFIED}" >> "$GITHUB_OUTPUT" + echo "Repository Modified: ${MODIFIED}" >> "$GITHUB_STEP_SUMMARY" + - name: Push changes + if: steps.git-check.outputs.MODIFIED == 'true' + run: git push --force-with-lease