-
-
Notifications
You must be signed in to change notification settings - Fork 260
57 lines (54 loc) · 2.66 KB
/
merge-pro.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Merge community changes into pro repo
on:
push:
branches:
- master
jobs:
updateFork:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: tiny-pilot/tinypilot-pro
token: ${{ secrets.PR_BOT_PAT }}
- name: Reset the default branch with upstream changes
run: |
git remote add upstream https://github.com/tiny-pilot/tinypilot.git
git fetch upstream master:upstream-master
git reset --hard upstream-master
- name: Get the URL of the original community PR
run: |
set -ux
COMMUNITY_PR_URL="$(curl \
--silent \
--show-error \
https://api.github.com/repos/tiny-pilot/tinypilot/commits/${{ github.sha }}/pulls?per_page=1 | \
jq \
--raw-output \
'.[0].html_url | select (.!=null)')"
readonly COMMUNITY_PR_URL
echo "COMMUNITY_PR_URL=${COMMUNITY_PR_URL}" >> "${GITHUB_ENV}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PR_BOT_PAT }}
branch: community-changes-${{ github.sha }}
delete-branch: true
# If the committer to the community repo (github.actor) has no access
# to the pro repo, the PR will be unassigned.
assignees: ${{ github.actor }}
reviewers: ${{ github.actor }}
title: Merge changes from community repository
body: |
Related ${{ env.COMMUNITY_PR_URL }}
@${{ github.actor }}, please merge [your changes from the Community repository](https://github.com/tiny-pilot/tinypilot/commit/${{ github.sha }}):
1. Update this branch with latest `master`
- If there are merge conflicts, it’s best to resolve them locally.
1. Check whether you need to make any Pro-specific adjustments to the code
1. Review and approve your changes
- You usually do this yourself. In case you had to make non-trivial adjustments, it’s also okay to request a proper peer review.
1. Set the merge style to “Create a merge commit” (regular merge)
- **Do not use “Squash and merge”!** If you accidentally squash, it’s not a disaster, but it will create a bit of noise on the subsequent PR from Community.
- We want a regular merge to preserve the commit history from Community
1. Merge the PR
Note that Github remembers the merge style of your last PR in this repo, so for your next “regular” PR, you may have to manually set it to “Squash and merge” again.