forked from microsoft/DeepSpeed
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.98 KB
/
auto-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
52
53
54
55
56
57
58
59
name: AutoSync
on:
push:
branches:
- 'master'
jobs:
Create-PR:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GHP_TOKEN }}
repository: ${{ secrets.DST_REPO }}
ref: ${{ secrets.DST_REPO_BRANCH }}
path: dst-repo
- name: Get PR data
run: |
echo "REPO=${{ github.repository }}" >> $GITHUB_ENV
echo "COMMIT_SHA=${{ github.event.after }}" >> $GITHUB_ENV
echo "SHORT_SHA=$(echo ${{ github.event.after }} | cut -c1-8)" >> $GITHUB_ENV
echo "USERNAME=${{ github.event.head_commit.author.username }}" >> $GITHUB_ENV
echo "USER_EMAIL=${{ github.event.head_commit.author.username }}@users.noreply.github.com" >> $GITHUB_ENV
echo "PR_NAME=$(echo '${{ github.event.head_commit.message }}' | head -1 | sed 's|#|${{ github.repository }}#|g')" >> $GITHUB_ENV
- name: Cherry pick commit
continue-on-error: true
run: |
cd dst-repo
git config --global user.name ${{ env.USERNAME }}
git config --global user.email ${{ env.USER_EMAIL }}
git fetch https://github.com/${{ env.REPO }}.git master
git cherry-pick FETCH_HEAD --strategy-option octopus
- name: Add modified files
run: |
cd dst-repo
git add .
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
path: dst-repo
token: ${{ secrets.GHP_TOKEN }}
body: |
**Auto-generated PR**
Repo - [${{ env.REPO }}](https://github.com/${{ env.REPO }})
PR name - ${{ env.PR_NAME }}
Commit - ${{ env.REPO }}@${{ env.COMMIT_SHA }}
Author - @${{ env.USERNAME }}
branch: AutoPR/${{ env.SHORT_SHA }}
assignees: ${{ env.USERNAME }}
title: ${{ env.PR_NAME }}
labels: AutoPR
author: ${{ env.USERNAME }} <${{ env.USER_EMAIL }}>