diff --git a/.github/workflows/auto-release-pr.yml b/.github/workflows/auto-release-pr.yml new file mode 100644 index 0000000..f2f6946 --- /dev/null +++ b/.github/workflows/auto-release-pr.yml @@ -0,0 +1,37 @@ +name: Auto release PR + +on: + push: + branches: [dev] + +permissions: + contents: read + pull-requests: write + +jobs: + open-release-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Check for existing PR + id: check + run: | + pr=$(gh pr list --base release --head dev --state open --json number --jq '.[0].number') + echo "existing_pr=$pr" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create PR if none exists + if: steps.check.outputs.existing_pr == '' + run: | + gh pr create \ + --base release \ + --head dev \ + --title "Release: merge dev into release" \ + --body "Automated PR to merge dev changes into release." + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}