Skip to content

Commit

Permalink
feat: Add template sync
Browse files Browse the repository at this point in the history
  • Loading branch information
oprypkhantc committed Apr 25, 2024
1 parent 560c07d commit bf8936e
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/template-sync.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"repositories": [
{
"url": "https://github.com/tenantcloud/laravel-package-skeleton",
"branch": "sync"
}
]
}
64 changes: 64 additions & 0 deletions .github/workflows/template-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Template sync

on:
push:
branches: ['sync']
workflow_dispatch:
schedule:
- cron: '*/5 * * * *'

jobs:
sync:
name: Sync
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Sync from template
id: sync_from_template
uses: tenantcloud/template-sync@v1.0.0-alpha.11
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Reformat
uses: actionsx/prettier@v2
with:
args: --write .

- name: Generate token to read from source repo
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.PACKAGE_SYNC_APP_ID }}
private_key: ${{ secrets.PACKAGE_SYNC_PRIVATE_KEY }}

- name: Create PR
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate_token.outputs.token }}
committer: 'package-sync[bot] <165811605+package-sync[bot]@users.noreply.github.com>'
branch: 'template-sync'
delete-branch: true
title: 'chore: Sync changes from the template'
commit-message: 'chore: Sync changes from the template'
body: ${{ steps.sync_from_template.outputs.report }}
assignees: oprypkhantc
reviewers: oprypkhantc

# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# GitHub automatically disables `schedule` workflows in public repositories
# after 60 days without commits, so this job is there to prevent it.
workflow-keepalive:
name: Workflow keepalive
runs-on: ubuntu-latest
if: github.event_name == 'schedule'

permissions:
actions: write

steps:
- uses: liskin/gh-workflow-keepalive@v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit bf8936e

Please sign in to comment.