-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: thefourCraft <[email protected]>
- Loading branch information
1 parent
27128bc
commit 63dd7bf
Showing
1 changed file
with
41 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,41 @@ | ||
name: Fork PR Handler with GitHub CLI | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
handle-fork-pr: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.head.repo.fork == true | ||
steps: | ||
- name: Checkout code from the fork's PR | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "GitHub Action" | ||
git config user.email "[email protected]" | ||
- name: Create and push new branch | ||
run: | | ||
NEW_BRANCH="build-${{ github.event.pull_request.number }}" | ||
git checkout -b $NEW_BRANCH | ||
git push origin $NEW_BRANCH | ||
- name: Create PR in original repository | ||
run: | | ||
gh pr create \ | ||
--title "Automated PR for changes from fork #${{ github.event.pull_request.number }}" \ | ||
--body "This is an automated PR to merge changes from the fork's PR #${{ github.event.pull_request.number }}" \ | ||
--base production \ | ||
--head ${{ github.repository }}:$NEW_BRANCH \ | ||
--repo ${{ github.repository }} \ | ||
--label "automated-pr" \ | ||
--reviewer "team_reviewers" \ | ||
--assignee "@me" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |