-
Notifications
You must be signed in to change notification settings - Fork 14
51 lines (50 loc) · 1.86 KB
/
bflat-sync.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 from dotnet/runtime repo
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch (ex: main, release/7.0)'
required: true
jobs:
sync:
if: ${{ github.actor == 'MichalStrehovsky' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
ref: 'bflat-${{ github.event.inputs.branch }}'
fetch-depth: 0
- name: Configure git
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git remote add dotnet https://github.com/dotnet/runtime.git
- name: Create branch
run: git checkout -b merge-${{ github.event.inputs.branch }}
- name: Merge from dotnet
run: git pull --ff dotnet ${{ github.event.inputs.branch }}
- name: Move any unrelated files under .github
run: |
rsync -rv --include '*/' --exclude 'workflows/bflat*' --remove-source-files .github/ .gh-original/
git add \*
git diff-index --quiet HEAD || something_moved=$?
if [ -n "$something_moved" ]
then
echo Got new files we need to move
git commit -m "Move added files"
fi
- name: Check if branch already exists
continue-on-error: true
id: branch_exists
run: git ls-remote --exit-code --heads origin merge-${{ github.event.inputs.branch }}
- name: Push
run: git push --force --set-upstream origin HEAD:merge-${{ github.event.inputs.branch }}
- name: Create pull request
if: steps.branch_exists.outcome != 'success'
uses: ./bflat/actions/pullrequest
with:
auth_token: ${{ secrets.GITHUB_TOKEN }}
source_branch: merge-${{ github.event.inputs.branch }}
target_branch: bflat-${{ github.event.inputs.branch }}
pr_title: '[${{ github.event.inputs.branch }}] Merge from dotnet/runtime'