generated from StabilityNexus/Template-Repo
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Add template sync workflow for automated repository synchronization #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5e0d37c
Add template sync workflow for automated repository synchronization
kpj2006 0283f13
improvement
kpj2006 ba739d9
Add .templatesyncignore to exclude specific files from template sync
kpj2006 775b658
Add link to documentation for editing .templatesyncignore
kpj2006 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| name: Template Sync | ||
|
|
||
| on: | ||
| # cronjob trigger - runs monthly on the 1st at midnight | ||
| schedule: | ||
| - cron: "0 0 1 * *" | ||
| workflow_dispatch: | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide 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 | ||
kpj2006 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| steps: | ||
| # Check out the repository | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
kpj2006 marked this conversation as resolved.
Show resolved
Hide 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 | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| upstream_branch: main # defaults to main | ||
| pr_labels: template_sync,auto_pr # defaults to template_sync | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| source_gh_token: ${{ secrets.GITHUB_TOKEN }} | ||
| is_pr_cleanup: true # for not open multiple PRs | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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
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
There was a problem hiding this comment.
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
.templatesyncignorefile 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.