Skip to content

create-test-pr

create-test-pr #134

name: create-test-pr
on:
workflow_dispatch:
env:
TEST_BRANCH: main-test
jobs:
sync-branch:
name: Update test branch
runs-on: ubuntu-latest
steps:
- name: Check out main branch
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Check out main branch
uses: connor-baer/action-sync-branch@3d55a053fbea05b71050bc26c9c37913981bd8b5 # v1.0.3
with:
branch: ${{ env.TEST_BRANCH }}
token: ${{ secrets.GH_TOKEN }}
force: true
create-pr:
runs-on: ubuntu-latest
needs:
- sync-branch
steps:
- name: Check out test branch
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: ${{ env.TEST_BRANCH }}
persist-credentials: false
- name: Make changes
id: changes
run: |
echo >> README.md
number="${RANDOM}"
echo "${number}" >> README.md
echo "::set-output name=number::${number}"
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_KEY }}
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50 # v6
with:
token: ${{ steps.generate_token.outputs.token }}
title: Test Pull Request (${{ steps.changes.outputs.number }})
commit-message: Test commit.
branch: test-pr-${{ steps.changes.outputs.number }}