From 337cfdc15b53fa5aa7924459a13efd2f8d7ca935 Mon Sep 17 00:00:00 2001 From: C4illin Date: Thu, 30 May 2024 16:16:30 +0200 Subject: [PATCH] chore: add maintain PR workflow This commit adds a new workflow file, `.github/workflows/maintain-pr.yml`, which sets up a workflow to maintain release merge pull requests. The workflow is triggered on pushes to the `main` branch. It includes steps to check for an existing PR, create/update a PR if it doesn't exist, and reset the release branch if needed. --- .github/workflows/maintain-pr.yml | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/maintain-pr.yml diff --git a/.github/workflows/maintain-pr.yml b/.github/workflows/maintain-pr.yml new file mode 100644 index 0000000..110ed28 --- /dev/null +++ b/.github/workflows/maintain-pr.yml @@ -0,0 +1,40 @@ +name: Maintain Release Merge PR + +on: + push: + branches: + - main + +jobs: + update-release-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Git + run: | + git config user.name github-actions + git config user.email github-actions@github.com + - name: Check for existing PR + id: find-pr + uses: juliangruber/find-pull-request-action@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + branch: release + - uses: actions/checkout@v4 + if: steps.find-pr.outputs.number == '' + with: + ref: release + - name: Reset release branch + if: steps.find-pr.outputs.number == '' + run: | + git fetch origin main:main + git reset --hard main + - name: Create/Update PR + if: steps.find-pr.outputs.number == '' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update release branch + title: Merge Release Auto-PR + body: Merging this PR will invoke release actions + branch: auto-update/release \ No newline at end of file