-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.59 KB
/
main-branch-pr.yaml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Create Main Branch PR
on:
pull_request:
types:
- closed
jobs:
create_main_branch_pr:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'staging' }}
steps:
- name: Debugging
run: |
echo "Merged: ${{ github.event.pull_request.merged }}"
echo "Base Ref: ${{ github.event.pull_request.base.ref }}"
- uses: actions/checkout@v3
with:
token: ${{ secrets.MY_PAT }}
fetch-depth: 0
- name: Check GitHub CLI version
run: gh --version
- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Fetch latest changes
run: git fetch origin
- name: Pull latest changes
run: |
git checkout staging
git pull origin staging
git checkout main
git pull origin main
- name: Check PR user
id: pr-user
run: |
echo "PR_USER=${{ github.event.pull_request.user.login }}" >> $GITHUB_OUTPUT
- name: Create Main Branch PR
run: |
# Extract the PR number from the merged pull request
PR_NUMBER="${{ github.event.pull_request.number }}"
PR_URL="${{ github.event.pull_request.html_url }}"
PR_USER="${{ steps.pr-user.outputs.PR_USER }}"
bash ./.github/scripts/create-pr-script.sh $PR_NUMBER $PR_URL $PR_USER
env:
GH_TOKEN: ${{ secrets.MY_PAT }}