forked from exions/merge-upstream
-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
51 lines (49 loc) · 1.81 KB
/
action.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
name: "Sync Upstream"
description: "Sync changes from the uppstream repo you had forked from."
author: "zhangnew"
branding:
icon: git-merge
color: green
inputs:
username:
description: "User name - required for git commits"
default: "sync-upstream-bot"
useremail:
description: "User email - required for git commits"
default: "[email protected]"
upstream:
description: "Upstream repository owner/name. For example, zhangnew/sync-upstream"
default: "master"
required: true
upstream-branch:
description: "Upstream branch to merge from. For example, master"
default: "master"
required: true
branch:
description: "Branch to merge to. For example, master"
default: "master"
required: true
token:
description: >
Personal access token (PAT) used to fetch the repository. The PAT is configured
with the local git config, which enables your scripts to run authenticated git commands. The post-job step removes the PAT.
We recommend using a service account with the least permissions necessary.
Also when generating a new PAT, select the least scopes necessary.
[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
default: ${{ github.token }}
runs:
using: "composite"
steps:
- run: |
set -x
git remote add -f upstream "https://github.com/${{ inputs.upstream }}.git"
git remote -v
git branch --all
git config user.email "${{ inputs.useremail }}"
git config user.name "${{ inputs.username }}"
git config --list
git checkout ${{ inputs.branch }}
git rebase upstream/${{ inputs.upstream-branch }}
git pull --rebase
git push
shell: bash