Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/template-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Template Sync
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we specify which files should be kept in sync?

Take the readme file for instance. A new repo using the template repo should modify the readme for its own needs. If the readme template in the template repo gets updated, it is not clear how the readme in the new repo should be synchronized...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bydefault it sync all file in template repo except in .github/workflows one due to github policy

for that i have also created a issue:#76
even if you want to ignore a file mention it specially

Image

Once the workflow is triggered, it will compare the target repository with the source, and will open a Pull Request on the target repository if there are any differences You can see how it looks like in the Pull Requests #1 and #2 from dotdc/terraform-module-example.

have a look on : https://github.com/AndreasAugustin/actions-template-sync?tab=readme-ov-file#ignore-files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's already add .templatesyncignore file to the template repo, to make it ignore files like README.md, which are supposed to be customized in the destination repo and then not overwritten/synced by the tempalte repo again.


on:
# cronjob trigger - runs monthly on the 1st at midnight
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
Comment thread
coderabbitai[bot] marked this conversation as resolved.
jobs:
repo-sync:
runs-on: ubuntu-latest
if: github.repository != 'AOSSIE-Org/Template-Repo'
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
contents: write
pull-requests: write
Comment thread
kpj2006 marked this conversation as resolved.

steps:
# Check out the repository
- name: Checkout
uses: actions/checkout@v4
Comment thread
kpj2006 marked this conversation as resolved.
# https://github.com/actions/checkout#usage
# uncomment if you use submodules within the repository
# with:
# submodules: true

- name: actions-template-sync
uses: AndreasAugustin/actions-template-sync@v2
with:
source_repo_path: AOSSIE-Org/Template-Repo
Comment thread
coderabbitai[bot] marked this conversation as resolved.
upstream_branch: main # defaults to main
pr_labels: template_sync,auto_pr # defaults to template_sync
Comment thread
coderabbitai[bot] marked this conversation as resolved.
source_gh_token: ${{ secrets.GITHUB_TOKEN }}
is_pr_cleanup: true # for not open multiple PRs
23 changes: 23 additions & 0 deletions .templatesyncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# read this before editing in this file: https://github.com/AndreasAugustin/actions-template-sync?tab=readme-ov-file#ignore-files
# .templatesyncignore
# Files and folders to exclude from template sync
# Uses glob pattern syntax similar to .gitignore
Comment thread
kpj2006 marked this conversation as resolved.
# Note: This file itself cannot be synced - any template changes will be restored automatically

# Repository-specific files that should not be synced
README.md
LICENSE

# GitHub workflows are not synced by default due to GitHub policy
# .github/workflows/
Comment thread
kpj2006 marked this conversation as resolved.

# Add more patterns to exclude specific files or directories
# Examples:
# docs/
# *.log
# config/local.yml

# Use :! prefix for exceptions (pathspec syntax)
# Example - ignore all files except specific ones:
# :!newfile-1.txt
# *
Comment thread
kpj2006 marked this conversation as resolved.
Loading