diff --git a/.github/workflows/set-base-branch.yaml b/.github/workflows/set-base-branch.yaml new file mode 100644 index 0000000..30fb58c --- /dev/null +++ b/.github/workflows/set-base-branch.yaml @@ -0,0 +1,33 @@ +name: Set Base Branch + +on: + workflow_call: + inputs: + development-branch-name: + description: 'The name of the development branch that pull requests should target' + required: false + type: string + default: 'main' + stable-branch-name: + description: 'The name of the stable branch' + required: false + type: string + default: 'stable' + +jobs: + set-base-branch: + if: github.base_ref == inputs.stable-branch-name + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Set the pull request base ref + env: + GH_TOKEN: ${{ github.token }} + run: | + gh api \ + --method PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ github.repository }}/pulls/${{ github.event.number }} \ + -f base='${{ inputs.development-branch-name }}'