Skip to content

Commit

Permalink
Merge pull request #58 from Mogyuchi/feature/#57_Add_auto_pr_action
Browse files Browse the repository at this point in the history
Draft PR 作成アクションを追加
  • Loading branch information
TwoSquirrels committed May 30, 2022
2 parents c86a7ef + 342c0a0 commit e2e7450
Showing 1 changed file with 38 additions and 0 deletions.
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

0 comments on commit e2e7450

Please sign in to comment.