Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft PR 作成アクションを追加 #58

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/auto_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# SPDX-License-Identifier: MIT

name: Auto PR

on: create

jobs:
pr:
if: github.event.ref_type == 'branch' && ! github.event.repository.fork
name: Create PR
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup git
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git config push.default current
- name: Create a pull request
run: |
ISSUE=`echo "${{ github.event.ref }}" | grep -oE '#[0-9]+'`
if ${{ startsWith(github.event.ref, 'hotfix/') }}; then
if git diff --quiet origin/main; then
git commit --allow-empty -m "empty commit"
git push
fi
gh pr create --draft --base main --assignee ${{ github.event.sender.login }} --title "${{ github.event.ref }}" --body "close $ISSUE"
else
if git diff --quiet origin/develop; then
git commit --allow-empty -m "empty commit"
git push
fi
gh pr create --draft --base develop --assignee ${{ github.event.sender.login }} --title "${{ github.event.ref }}" --body "close $ISSUE"
fi