-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #1444 Update git-auto-issue-branch-creation.yml
- Loading branch information
1 parent
65b0ecc
commit 0b11bc5
Showing
1 changed file
with
22 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 |
---|---|---|
|
@@ -6,6 +6,10 @@ on: | |
jobs: | ||
create-issue-branch: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
issues: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -47,3 +51,21 @@ jobs: | |
git checkout -b "${{ steps.issue.outputs.number }}-${{ env.ISSUE_BRANCH_NAME }}" | ||
git push -u origin HEAD | ||
- name: Create Empty Commit to allow empty pr | ||
run: | | ||
git config --global user.name "nobody" | ||
git config --global user.email "[email protected]" | ||
git commit --allow-empty -m "Empty commit to allow auto PR creation" | ||
git fetch origin | ||
git rebase --strategy-option=theirs origin/main --verbose # thanks https://joht.github.io/johtizen/build/2022/01/20/github-actions-push-into-repository.html | ||
git push --verbose | ||
- name: Creating PR based on branch name ${{ github.ref_name }} | ||
run: | | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/KarmaComputing/create-pull-request-on-branch-creation/pulls \ | ||
-d '{"title": "#${{ steps.issue.outputs.number }} ${{ env.ISSUE_BRANCH_NAME }}","body":"Pull request related issue: #${{ steps.issue.outputs.number }}. Please pull these awesome changes in!","head":"${{ steps.issue.outputs.number }}-${{ env.ISSUE_BRANCH_NAME }}","base":"main"}' |