Skip to content

Commit

Permalink
Fix #1444 Update git-auto-issue-branch-creation.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsimpson authored Jan 27, 2025
1 parent 65b0ecc commit 0b11bc5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/git-auto-issue-branch-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"}'

0 comments on commit 0b11bc5

Please sign in to comment.