create-test-pr #132
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
branch: ${{ env.TEST_BRANCH }} | |
token: ${{ secrets.GITHUB_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 }} |