-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from Mogyuchi/feature/#57_Add_auto_pr_action
Draft PR 作成アクションを追加
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
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 |