Add workflow for sync with upstream
This commit is contained in:
parent
b61b880904
commit
e394c14a70
1 changed files with 66 additions and 0 deletions
66
.github/workflows/upstream_sync.yaml
vendored
Normal file
66
.github/workflows/upstream_sync.yaml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
name: "Upstream Sync"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 30 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
sync:
|
||||
name: Sync with upstream
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
has_new_commits: ${{ steps.sync.outputs.has_new_commits }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: sync/master
|
||||
|
||||
- name: Sync changes with upstream
|
||||
id: sync
|
||||
uses: aormsby/Fork-Sync-With-Upstream-action@v3.2
|
||||
with:
|
||||
target_sync_branch: sync/master
|
||||
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
upstream_sync_branch: master
|
||||
upstream_sync_repo: alexta69/metube
|
||||
|
||||
- name: New commits found
|
||||
if: steps.sync.outputs.has_new_commits == 'true'
|
||||
run: echo "New commits were found to sync."
|
||||
|
||||
- name: No new commits found
|
||||
if: steps.sync.outputs.has_new_commits == 'false'
|
||||
run: echo "There were no new commits."
|
||||
|
||||
pr:
|
||||
name: Create PR for upstream changes
|
||||
runs-on: ubuntu-latest
|
||||
needs: sync
|
||||
if: needs.sync.outputs.has_new_commits == 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Reset sync/master branch
|
||||
run: |
|
||||
git fetch origin sync/master:sync/master
|
||||
git reset --hard sync/master
|
||||
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
branch: upstream-changes
|
||||
title: "[sync] Changes from upstream"
|
||||
body: |
|
||||
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
|
||||
labels: |
|
||||
automated
|
||||
delete-branch: true
|
||||
Loading…
Reference in a new issue