Skip to content

Instantly share code, notes, and snippets.

@lohanidamodar
Created November 10, 2023 06:28
Show Gist options
  • Save lohanidamodar/54053e039c846e4b153234346e68c33a to your computer and use it in GitHub Desktop.
Save lohanidamodar/54053e039c846e4b153234346e68c33a to your computer and use it in GitHub Desktop.
Create new branch and PR for issue
name: Handle Issues
on:
issues:
types: [opened]
jobs:
create-branch-and-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create new branch
run: |
git config --global user.email "your-email@example.com"
git config --global user.name "Your Name"
git checkout -b issue-${{ github.event.issue.number }}
- name: Add template files
run: |
git pull origin main
cp path/to/your/template1 path/to/destination/template1
cp path/to/your/template2 path/to/destination/template2
git add .
git commit -m "Add template files for issue #${{ github.event.issue.number }}"
git push origin issue-${{ github.event.issue.number }}
- name: Create pull request
uses: repo-sync/pull-request@v2
with:
destination_branch: "main"
pr_title: "Pull Request for issue #${{ github.event.issue.number }}"
pr_body: "This pull request addresses the issue #${{ github.event.issue.number }}"
github_token: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment