Skip to content

Commit 150ad95

Browse files
[SL-ONLY] Add workflow to open PR from csa to main after the csa update is completed (#238)
1 parent 22a4380 commit 150ad95

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Open PR from csa to main
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
workflow_run:
9+
workflows: ["Daily Sync of the csa branch"]
10+
types:
11+
- completed
12+
workflow_dispatch:
13+
14+
jobs:
15+
open-pr:
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: main
22+
token: ${{secrets.WORKFLOW_TOKEN}}
23+
24+
- name: Checkout csa
25+
run: |
26+
git fetch origin csa:csa
27+
git reset --hard csa
28+
29+
- name: Create Pull Request
30+
uses: peter-evans/create-pull-request@v7
31+
with:
32+
branch: automation/update_main
33+
base: main
34+
title: "Sync csa branch with main"
35+
body: |
36+
This PR syncs the csa branch with the main branch.
37+
38+
**PR MUST BE MERGED WITH MERGE COMMIT - ADMIN MUST ENABLE THE OPTION**
39+
token: ${{secrets.GITHUB_TOKEN}}
40+
branch-token: ${{secrets.WORKFLOW_TOKEN}}
41+
labels: changing-submodules-on-purpose
42+
43+
- name: Comment on Pull Request
44+
uses: actions/github-script@v7
45+
with:
46+
github-token: ${{secrets.GITHUB_TOKEN}}
47+
script: |
48+
const pr_number = context.payload.workflow_run.pull_requests[0].number;
49+
github.issues.createComment({
50+
owner: context.repo.owner,
51+
repo: context.repo.repo,
52+
issue_number: pr_number,
53+
body: "Please merge this PR using **Merge Commit**."
54+
});

0 commit comments

Comments
 (0)