From f7c5e6964ee0cd734f0e1d2180ee41d61b398eff Mon Sep 17 00:00:00 2001 From: Matt Apperson Date: Mon, 10 Nov 2025 14:07:46 -0500 Subject: [PATCH] Add workflow to recreate staging branch when it doesn't exist --- .github/workflows/recreate-staging.yaml | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/recreate-staging.yaml diff --git a/.github/workflows/recreate-staging.yaml b/.github/workflows/recreate-staging.yaml new file mode 100644 index 00000000..de73e9ac --- /dev/null +++ b/.github/workflows/recreate-staging.yaml @@ -0,0 +1,36 @@ +name: Recreate Staging Branch + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + recreate-staging: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if staging branch exists + id: check-staging + run: | + if git ls-remote --heads origin staging | grep -q staging; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Recreate staging branch + if: steps.check-staging.outputs.exists == 'false' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -b staging + git push origin staging