Skip to content

Commit d426887

Browse files
committed
fix workflow
1 parent b155ad4 commit d426887

File tree

1 file changed

+68
-20
lines changed

1 file changed

+68
-20
lines changed

.github/workflows/subtree-sync.yml

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,75 @@
1-
name: Subtree sync PR
1+
name: Internal sync PR
22

33
on:
44
push:
5-
branches: [ "slice/internal" ]
5+
branches:
6+
- slice/internal # every push to this branch triggers the job
7+
8+
permissions: # required for the built-in token from 2024-08 onwards
9+
contents: write # create/update branches
10+
pull-requests: write # open/update PRs
611

712
jobs:
8-
open-pr:
13+
create-or-update-pr:
914
runs-on: ubuntu-latest
10-
permissions:
11-
contents: write
12-
pull-requests: write
15+
1316
steps:
14-
- uses: actions/checkout@v4
15-
16-
- name: Create PR to master
17-
env:
18-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
run: |
20-
gh pr create \
21-
--base master \
22-
--head slice/internal \
23-
--title "Internal Sync" \
24-
--body "This PR was opened automatically after the internal sync job pushed changes." \
25-
--repo ${{ github.repository }} \
26-
--fill \
27-
|| echo "PR already exists or no changes to PR"
17+
- name: Checkout slice/internal
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.ref }} # already on slice/internal
21+
22+
- name: Create or update PR to master
23+
uses: peter-evans/create-pull-request@v6
24+
with:
25+
# token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
# HEAD (source) and BASE (target) of the PR
28+
branch: slice/internal # head branch (already exists)
29+
base: master # target branch
30+
31+
# Cosmetic bits
32+
title: "Sync slice/internal → master"
33+
body: |
34+
This PR was opened automatically after the internal sync job pushed changes.
35+
36+
Triggering commit: ${{ github.sha }}
37+
commit-message: "[bot] chore: sync slice/internal → master"
38+
39+
# Optional housekeeping — comment these in if you like
40+
# draft: true # open as draft first
41+
# labels: auto-pr, internal-sync # any default labels to attach
42+
43+
# name: Subtree sync PR
44+
45+
# on:
46+
# push:
47+
# branches: [ "slice/internal" ]
48+
49+
# jobs:
50+
# open-pr:
51+
# runs-on: ubuntu-latest
52+
# permissions:
53+
# contents: write
54+
# pull-requests: write
55+
# steps:
56+
# - uses: actions/checkout@v4
57+
# with:
58+
# fetch-depth: 0
59+
# ref: ${{ github.ref }}
60+
61+
# - name: Fetch master branch
62+
# run: git fetch origin master:refs/remotes/origin/master
63+
64+
# - name: Create PR to master
65+
# env:
66+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
# run: |
68+
# gh pr create \
69+
# --base master \
70+
# --head slice/internal \
71+
# --title "Internal Sync" \
72+
# --body "This PR was opened automatically after the internal sync job pushed changes." \
73+
# --repo ${{ github.repository }} \
74+
# --fill \
75+
# || echo "PR already exists or no changes to PR"

0 commit comments

Comments
 (0)