-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (59 loc) · 2.03 KB
/
update_upstream_from_fork.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
58
59
60
61
62
63
# TODO Minimize the PAT permissions
name: Update Upstream From Fork
on:
push:
branches:
- master
- v1.18
- v1.17
env:
GH_TOKEN: ${{ secrets.SYNC_TEST_ADMIN2 }}
GH_REPO: ${{ github.repository }}
BRANCH_REF: ${{ github.ref_name }}
REF: ${{ github.event.REF}}
BEFORE_SHA: ${{ github.event.before }}
LAST_SHA: ${{ github.event.after}}
UPSTREAM: https://github.com/solana-labs/sync_test.git
GITHUB_OBJ: ${{ toJSON(github) }}
jobs:
update-upstream-from-fork:
# TODO need to update this repo name to anza-xyz/agave
if: github.repository == 'willhickey/sync_test'
name: "Update Upstream From Fork"
runs-on: ubuntu-latest
steps:
- name: Echo git status
# TODO consolidate the status logging in the next few steps
run: |
echo "---------------"
echo "gh auth status"
gh auth status
echo "---------------"
echo "git config -l: "
git config -l
echo "---------------"
shell: bash
- uses: actions/checkout@v4
with:
# By default checkout only gets 1 commit. We want to cherry-pick
# all the commits from the push, so fetch the entire history
fetch-depth: 0
# By default checkout uses secrets.GITHUB_TOKEN. That token won't
# have any permissions in the upstream repo, so we need to override it
# with a Personal Access Token that can access both repos
token: ${{ secrets.SYNC_TEST_ADMIN2 }}
- name: Add remote for upstream
run: git remote add upstream $UPSTREAM
shell: bash
- name: show remotes and branches
run: |
git fetch --all
git remote --verbose
git branch --all
git log --oneline "origin/$BRANCH_REF"
git log --oneline "remotes/upstream/$BRANCH_REF"
shell: bash
- name: Cherry pick from origin to upstream
run: |
.github/workflows/cherry-pick-from-branch.sh upstream "$BRANCH_REF" "$BEFORE_SHA" "$LAST_SHA"
shell: bash