-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (30 loc) · 1.28 KB
/
opener.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Create PR on Issue Open
on:
issues:
types: [opened]
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Create branch and add commit
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
branch_name="issue-${GITHUB_EVENT_ISSUE_NUMBER}"
git checkout -b $branch_name
# Create a dummy file or modify an existing file
echo "This file is created in response to Issue #${GITHUB_EVENT_ISSUE_NUMBER}" > issue_${GITHUB_EVENT_ISSUE_NUMBER}.txt
git add issue_${GITHUB_EVENT_ISSUE_NUMBER}.txt
git commit -m "Initialize branch for Issue #${GITHUB_EVENT_ISSUE_NUMBER}"
git push -u origin $branch_name
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--base main \
--head "issue-${GITHUB_EVENT_ISSUE_NUMBER}" \
--title "Address Issue #${GITHUB_EVENT_ISSUE_NUMBER}" \
--body "This PR is created in response to Issue #${GITHUB_EVENT_ISSUE_NUMBER}. Please review and update as necessary."