|
| 1 | +name: Create Candidate -> Production Pull Request |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | +jobs: |
| 7 | + create-pull-request: |
| 8 | + runs-on: ubuntu-latest-xl |
| 9 | + permissions: |
| 10 | + pull-requests: write |
| 11 | + contents: write |
| 12 | + steps: |
| 13 | + - name: Add permissions |
| 14 | + run: git config --global --add safe.directory /github/workspace |
| 15 | + continue-on-error: true |
| 16 | + - name: Check out repository code |
| 17 | + uses: actions/checkout@v3 |
| 18 | + continue-on-error: true |
| 19 | + - name: Get package version |
| 20 | + id: package-version |
| 21 | + run: echo "::set-output name=PACKAGE_VERSION::$(cat package.json | jq -r .version)" |
| 22 | + # The pull-request action will now only run if the checkout action was successful. |
| 23 | + - name: Create pull request |
| 24 | + if: ${{ success() }} # This step runs only if all previous steps succeeded |
| 25 | + uses: repo-sync/pull-request@v2 |
| 26 | + continue-on-error: true |
| 27 | + with: |
| 28 | + destination_branch: "release" |
| 29 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + pr_label: "prod-deploy,automated-pr" |
| 31 | + pr_title: "[${{ github.event.repository.name }}] Production Deploy" |
| 32 | + pr_body: | |
| 33 | + This is an automated pull request to release the candidate branch into production, which will trigger a deployment. |
| 34 | + It was created by the [Production PR] action. |
| 35 | + # Optionally, you can add a step here to notify you if the previous steps failed, |
| 36 | + # so that you can take appropriate actions. |
| 37 | + - name: Notify Failure |
| 38 | + if: ${{ failure() }} # This step runs only if any of the previous steps failed |
| 39 | + run: echo "A step in the job failed. Please check the GitHub Actions logs for details." |
| 40 | + # You could also trigger other types of notifications, such as sending an email, an alert to Slack, etc. |
0 commit comments