Sync repo #96
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 repo | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
commits: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
repository: casey/just | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ./.sync-repo | |
ref: master | |
- name: Replace files | |
shell: bash | |
run: | | |
rm -rf ./.sync-repo/.git | |
rsync -av --exclude='.github/' ./.sync-repo/ . | |
rm -rf ./.sync-repo/ | |
- name: Create PR | |
id: cpr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "chore: sync files from source repo" | |
committer: gnpaone <[email protected]> | |
author: gnpaone <[email protected]> | |
branch: sync-action | |
base: master | |
delete-branch: true | |
title: Sync source repo | |
labels: ":zap: pull" | |
# - name: Identify merge conflict | |
# if: steps.cpr.outputs.pull-request-operation == 'created' | |
# id: conf | |
# uses: codytseng/auto-comment-merge-conflicts@v1 | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# label-name: ":no_entry: merge-conflict" | |
# - name: Assign PR | |
# if: steps.conf.outputs.new-conflicting-prs && (Object.keys(steps.conf.outputs.new-conflicting-prs).length > 0) && (String(steps.cpr.outputs.pull-request-number) == String(steps.conf.outputs.new-conflicting-prs.number)) | |
# uses: wow-actions/auto-assign@v3 | |
# with: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# assignees: gnpaone | |
- name: Enable pull request automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
- name: Delete PRs head branch | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: dawidd6/action-delete-branch@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
numbers: ${{ steps.cpr.outputs.pull-request-number }} | |