Skip to content

Comments

Add template sync workflow for automated repository synchronization#74

Open
kpj2006 wants to merge 4 commits intoAOSSIE-Org:mainfrom
kpj2006:auto-pr
Open

Add template sync workflow for automated repository synchronization#74
kpj2006 wants to merge 4 commits intoAOSSIE-Org:mainfrom
kpj2006:auto-pr

Conversation

@kpj2006
Copy link
Contributor

@kpj2006 kpj2006 commented Feb 21, 2026

Addressed Issues:

Fixes #(issue number)

Screenshots/Recordings:

Additional Notes:

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • Chores
    • Added an automated template synchronization workflow that runs monthly (1st) and can be triggered manually; it performs repo syncs and opens labeled update pull requests with permission to update repository contents.
    • Added a template-sync ignore configuration to define repository-specific exclusions (supports glob patterns and exception prefixes) with guidance for customizing excluded paths.

@github-actions github-actions bot added no-issue-linked PR is not linked to any issue ci-cd CI/CD pipeline changes configuration Configuration file changes github-actions GitHub Actions workflow changes labels Feb 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

Walkthrough

Adds a scheduled monthly GitHub Actions workflow to sync templates and a .templatesyncignore file listing gitignore-style patterns to exclude repository-specific files from template synchronization.

Changes

Cohort / File(s) Summary
Template sync workflow
.github/workflows/template-sync.yml
Adds a GitHub Actions workflow scheduled monthly (1st @ 00:00) with workflow_dispatch; job repo-sync runs on ubuntu-latest, grants write permissions for contents and pull-requests, checks out the repo, and runs actions-template-sync@v2 with source_repo_path, upstream_branch: main, and pr_labels: template_sync,auto_pr.
Template sync ignore rules
.templatesyncignore
Adds gitignore-style patterns to exclude repo-specific files/directories (e.g., README.md, LICENSE, .github/workflows/**) from template synchronization; includes examples and exception syntax (:!) and notes that the file itself cannot be synced.

Sequence Diagram(s)

sequenceDiagram
  participant Scheduler as Scheduler (cron / manual)
  participant GHA as GitHub Actions
  participant Runner as Runner (ubuntu-latest)
  participant Action as actions-template-sync@v2
  participant Upstream as Upstream Repo
  participant Repo as Target Repo

  Scheduler->>GHA: trigger workflow (cron / workflow_dispatch)
  GHA->>Runner: start job (repo-sync)
  Runner->>Runner: checkout Repo
  Runner->>Action: run actions-template-sync (source_repo_path, main, pr_labels)
  Action->>Upstream: fetch templates
  Action->>Runner: compute diffs, respect .templatesyncignore
  Action->>Repo: open/update PR with labels template_sync,auto_pr
  Repo->>GHA: PR created/updated
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Documentation

Suggested reviewers

  • Zahnentferner

Poem

🐰 I hop through YAML, neat and spry,

Monthly bells beneath the sky,
I tuck some files behind a line,
Then nudge a PR — all set, all fine.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and accurately summarizes the main change: adding a template sync workflow for automated repository synchronization, which matches the core changes in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/S Small PR (11-50 lines changed) external-contributor pending-coderabbit-review and removed size/S Small PR (11-50 lines changed) labels Feb 21, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/template-sync.yml:
- Around line 1-5: Add a top-level "name" field to the workflow YAML so the
Actions UI shows a friendly label instead of the filename; update the file
containing the "on:", "schedule:" and "workflow_dispatch:" keys to include a
descriptive name string at the top (e.g., name: "Template Sync" or similar)
immediately before the existing "on" block.
- Line 26: The workflow uses source_repo_path: AOSSIE-Org/Template-Repo which
makes the template trigger against itself; add a guard on the job or critical
step to skip execution when github.repository equals that template repo (e.g.,
add if: github.repository != 'AOSSIE-Org/Template-Repo' on the top-level job or
on the first step) so the sync only runs in downstream repos and not in the
template origin.
- Around line 23-28: Add the explicit source_gh_token input to the
actions-template-sync step to avoid the deprecated github_token behavior: in the
step using AndreasAugustin/actions-template-sync@v2 (the actions-template-sync
step that currently sets source_repo_path, upstream_branch, pr_labels), add
source_gh_token: ${{ secrets.GITHUB_TOKEN }} so the action receives the expected
token input and is compatible with v2.5.x+.

@github-actions github-actions bot added size/S Small PR (11-50 lines changed) and removed size/S Small PR (11-50 lines changed) labels Feb 21, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/template-sync.yml:
- Around line 13-15: The workflow currently attempts to push changes to
.github/workflows using GITHUB_TOKEN which is blocked; replace or supplement the
token by adding a repository secret containing a personal access token (PAT)
with contents:write and workflows:write scopes and pass that secret into the
sync action as target_gh_token (instead of or alongside GITHUB_TOKEN), and
ensure the action invocation and any inputs (e.g., target_gh_token) are updated
to consume the secret so pushes to workflow files succeed.
- Around line 19-20: Replace floating major-version action refs with immutable
commit SHAs: update the uses entries for actions/checkout@v4 and
AndreasAugustin/actions-template-sync@v2 to their corresponding full commit SHA
pins (e.g., actions/checkout@<full-sha> and
AndreasAugustin/actions-template-sync@<full-sha>), ensuring you fetch the exact
commit SHAs from the upstream repositories and test the workflow after updating
the uses strings.

@@ -0,0 +1,33 @@
name: Template Sync
Copy link
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
Contributor 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
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.

@github-actions github-actions bot added size/M Medium PR (51-200 lines changed) repeat-contributor PR from an external contributor who already had PRs merged and removed size/S Small PR (11-50 lines changed) labels Feb 21, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.templatesyncignore:
- Around line 10-11: Uncomment the ignored path for GitHub workflows so workflow
files are excluded from template sync: open the .templatesyncignore entry that
currently has a commented line "# .github/workflows/" and remove the leading "#"
(or otherwise restore the literal ".github/workflows/" line) so the ignore
contains an active ".github/workflows/" entry, preventing workflow files from
being synced into downstream repos.
- Around line 19-22: The example using the :! exception syntax is ambiguous
because the two lines ':!newfile-1.txt' and '*' are on separate uncommented
lines and may lead someone to uncomment only '*' which will ignore everything;
update the .templatesyncignore example to include a single inline clarification
next to the example (referencing ':!newfile-1.txt' and '*') stating that both
lines must be uncommented together as a pair to whitelist the file, and add a
brief warning that uncommenting only '*' will exclude all files from sync.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.templatesyncignore:
- Line 4: Update the header comment in .templatesyncignore to warn that negation
uses Git pathspec syntax (use ":!" for exclusions) rather than the .gitignore
"!" prefix; specifically edit the line that currently reads "Uses glob pattern
syntax similar to .gitignore" to include a parenthetical like "(note: negation
uses Git pathspec ':!' instead of '!' as in .gitignore)" so users aren't
misled—change the comment text wherever that header string appears.

---

Duplicate comments:
In @.templatesyncignore:
- Around line 20-23: The example is misleading about pathspec ordering and
paired-lines: change the sample so the global ignore "*" appears before the
exception entry and clarify that exceptions use the ":!<path>" prefix (e.g., "*"
followed by ":!newfile-1.txt"), and add a short note that exception lines must
be paired with the preceding ignore (i.e., place the "*" then each ":!..." on
its own subsequent line) so readers understand the required order and pairing
when using the ":!" syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd CI/CD pipeline changes configuration Configuration file changes external-contributor github-actions GitHub Actions workflow changes no-issue-linked PR is not linked to any issue pending-coderabbit-review repeat-contributor PR from an external contributor who already had PRs merged size/M Medium PR (51-200 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants