Skip to content

Commit 7c34f5b

Browse files
authored
Add auto PR workflow for sync branches
This workflow automatically creates or updates a pull request to the main branch when changes are pushed to branches matching 'sync/**'. It includes steps to derive the branch name and create the PR using the specified title and body.
1 parent 49a0b4a commit 7c34f5b

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
name: Auto PR on sync branches
3+
4+
on:
5+
push:
6+
branches:
7+
- 'sync/**'
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
jobs:
14+
create-pr:
15+
name: Create or update PR to main
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Derive branch name
20+
id: refs
21+
run: |
22+
BRANCH="${GITHUB_REF#refs/heads/}"
23+
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
24+
25+
- name: Create Pull Request
26+
uses: peter-evans/create-pull-request@v6
27+
with:
28+
branch: ${{ steps.refs.outputs.branch }}
29+
base: main
30+
title: "Sync from ADO ${{ steps.refs.outputs.branch }}"
31+
body: |
32+
Automated sync from ADO.
33+
Source branch: `${{ steps.refs.outputs.branch }}`
34+
Triggered by: `${{ github.actor }}` at `${{ github.event.head_commit.timestamp }}`
35+
draft: false
36+
delete-branch: false
37+
labels: |
38+
sync
39+
automated

0 commit comments

Comments
 (0)