Skip to content

Create PR (for code owner) #8

Create PR (for code owner)

Create PR (for code owner) #8

name: Create PR (for code owner)
on:
workflow_dispatch:
env:
base-branch: "main"
reviewers: "noritakaIzumi"
jobs:
create-pr:
name: Create a PR
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract branch name
id: extract_branch
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.REPOSITORY_APP_ID }}
private-key: ${{ secrets.REPOSITORY_APP_PRIVATE_KEY }}
- name: Create PR (after clean)
working-directory: .github
run: |
gh pr close ${{ steps.extract_branch.outputs.branch }} --comment "This PR is deprecated." || true
gh pr create \
--base ${{ env.base-branch }} \
--head ${{ steps.extract_branch.outputs.branch }} \
--title ${{ steps.extract_branch.outputs.branch }} \
--body-file "pull_request_template.md" \
--reviewer ${{ env.reviewers }} \
--assignee ${{ github.actor }} \
--draft
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}