1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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 }}>
|