Sync with upstream #953
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Sync with upstream' | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
repo-sync: | |
name: Repo Sync | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo repo_name=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}') >> $GITHUB_ENV | |
echo upstream_branch=$(echo "$GITHUB_REF_NAME" | awk -F / '{print $2}') >> $GITHUB_ENV | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: repo-sync/github-sync@v2 | |
name: Sync repo to branch | |
with: | |
source_repo: "wikimedia/${{ env.repo_name }}" | |
source_branch: ${{ env.upstream_branch }} | |
destination_branch: weirdgloop/repo-sync | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check for changes | |
run: | | |
if [ "$(git rev-parse --revs-only origin/weirdgloop/repo-sync)" != "$(git merge-base $GITHUB_REF_NAME origin/weirdgloop/repo-sync)" ]; then | |
echo changes_exist=true >> $GITHUB_ENV | |
fi | |
- uses: repo-sync/pull-request@v2 | |
name: Create pull request | |
if: env.changes_exist == 'true' | |
with: | |
source_branch: weirdgloop/repo-sync | |
destination_branch: ${{ github.ref_name }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
pr_title: "Sync with upstream" |