This action is used to update the sync configuration for the repo-file-sync-action action. Configuring this will allow for repositories created from a configured template to be auto-added to the sync.yaml file.
Create your sync file using the group format as described in the repo-file-sync-action
Add the new templates entry to the sync file
group:
- files:
- source: file1.txt
dest: file1.txt
- source: file2.txt
dest: file2.txt
templates: |
devnw/oss-template
devnw/template
repos: |
devnw/plex
Create your workflow (I used
.github/workflows/sync.yml
)
name: Sync Files
on:
push:
branches:
- main
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Sync Template Generated Repositories
uses: benjivesterby/update-sync-for-templates@main
with:
token: "${{ secrets.GH_PAT }}"
- name: Run Repo File Sync Action
uses: BetaHuhn/repo-file-sync-action@latest
with:
GH_PAT: ${{ secrets.GH_PAT }}
CONFIG_PATH: sync.yml
COMMIT_EACH_FILE: false
- Setup the
BetaHuhn/repo-file-sync-action
action in your GitHub organization.
- Example here: https://github.com/devnw/shared
- Create a template repository and add your workflow file
- Here's a functional example: Template Sync Action
- I recommend
.github/workflows/sync.yml
- Configure your Action
- Using the Configuration Options below configure your action.
name: Template Sync
on: [push, pull_request]
jobs:
update-sync:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2.4.0
- name: Sync Template Generated Repositories
uses: benjivesterby/update-sync-for-templates@latest # <-- This is the action
with:
token: "${{ secrets.GH_PAT }}"
- name: Run Repo File Sync Action
uses: BetaHuhn/repo-file-sync-action@latest
with:
GH_PAT: ${{ secrets.GH_PAT }}
CONFIG_PATH: sync.yml
COMMIT_EACH_FILE: false
In order for the Action to access your repositories you have to specify a Personal Access Token as the value for GH_PAT (GITHUB_TOKEN will not work). The PAT needs the full repo scope.
Option | Required | Description |
---|---|---|
token |
✅ | Personal access token which has permissions the configured templates in the sync file, see here for more. |
sync_file |
❌ | The sync yaml file (default: sync.yml ) |
org |
❌ | Org override for template search (default: template organization) |
author_name |
❌ | The name of the user that will be displayed as the author of the commit. (default: Github Action Bot) |
author_email |
❌ | The email of the user that will be displayed as the author of the commit. (default: Github Action Bot) |
This action is a heavily modified hard fork of original work done by Matthew Elphick matt.a.elphy@gmail.com