Skip to content

Commit

Permalink
Workflows to rebase preview and sanchonet branches on push to alpha, …
Browse files Browse the repository at this point in the history
…or workflow dispatch.
  • Loading branch information
TrevorBenson committed Apr 27, 2024
1 parent 03133dc commit d3b35c7
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/rebase-preview.yml
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions .github/workflows/rebase-sanchonet.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d3b35c7

Please sign in to comment.