-
Notifications
You must be signed in to change notification settings - Fork 11
59 lines (53 loc) · 1.64 KB
/
_generate-rebase.yaml
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
# Automatically rebase one branch on top of another; usually staging on top
# of main after a new package version was published.
name: Rebase branch
on:
workflow_call:
inputs:
to-head:
type: string
required: true
description: Branch that is being rebased
from-base:
type: string
required: true
description: Base branch
git-user-name:
type: string
required: true
description: Name of the git user who rebases and pushes the to_head branch
git-user-email:
type: string
required: true
description: Email address of said git user
secrets:
REPO_ACCESS_TOKEN:
required: true
permissions:
contents: read
jobs:
rebase:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
token: ${{ secrets.REPO_ACCESS_TOKEN }}
ref: ${{ github.ref_name }}
- name: Do rebase
run: |
git config --global user.name "$USER_NAME"
git config --global user.email "$USER_EMAIL"
git checkout "$TO_HEAD"
git rebase "$FROM_BASE"
git push --force-with-lease
env:
USER_NAME: ${{ inputs.git-user-name }}
USER_EMAIL: ${{ inputs.git-user-email }}
TO_HEAD: ${{ inputs.to-head }}
FROM_BASE: ${{ inputs.from-base }}