forked from ROCm/rocm-docs-core
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (58 loc) · 2.14 KB
/
merge_ff_only.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
name: Merge (ff only)
on:
workflow_dispatch:
workflow_call:
inputs:
source-repo:
required: true
type: string
description: Source repo path in the format [REPO_OWNER]/[REPO_NAME]
target-repo:
required: true
type: string
description: Target repo path in the format [REPO_OWNER]/[REPO_NAME]
source-branch:
required: true
type: string
description: Source branch from [SOURCE_REPO] that you want merged into [TARGET_BRANCH] from [TARGET_REPO]
target-branch:
required: true
type: string
description: Target branch to merge [SOURCE_BRANCH] from [SOURCE_REPO] into.
env-name:
required: false
type: string
description: Github environment name that your github token secret is in
secrets:
github-token:
required: true
jobs:
Promote:
environment: ${{ inputs.env-name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.source-repo }}
ref: ${{ inputs.source-branch }}
persist-credentials: false
fetch-depth: 0
- name: Merge source-branch into target-branch
env:
# gh needs this env var set with the exact name GH_TOKEN
GH_TOKEN: ${{ secrets.github-token }}
SOURCE_BRANCH: ${{ inputs.source-branch }}
TARGET_BRANCH: ${{ inputs.target-branch }}
TARGET_REPO: ${{ inputs.target-repo }}
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "auto-promote"
git config --global --add --bool push.autoSetupRemote true
git remote add target-repo "https://[email protected]/$TARGET_REPO.git"
git fetch -q target-repo
git branch --track "$TARGET_BRANCH-target-repo" remotes/target-repo/$TARGET_BRANCH
echo "After tracking target branch external"
git switch -q "$TARGET_BRANCH-target-repo"
git merge $SOURCE_BRANCH --ff-only
git push -q target-repo HEAD:$TARGET_BRANCH