metube/.github/workflows/upstream_sync.yaml
2022-02-07 20:15:27 +01:00

66 lines
1.7 KiB
YAML

name: "Upstream Sync"
on:
schedule:
- cron: '1 0 * * *'
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