{"id":15643127,"url":"https://github.com/varunsridharan/action-github-workflow-sync","last_synced_at":"2025-04-06T14:11:36.458Z","repository":{"id":40283863,"uuid":"274538132","full_name":"varunsridharan/action-github-workflow-sync","owner":"varunsridharan","description":"Github Action To Sync Github Action's Workflow Files Across Repositories","archived":false,"fork":false,"pushed_at":"2025-02-18T23:33:58.000Z","size":1090,"stargazers_count":68,"open_issues_count":11,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T13:08:12.069Z","etag":null,"topics":["github-action","github-action-docker","github-action-workflow","github-action-workflow-sync","github-actions","github-workflow","github-workflows","sync","vs-github-action","workflow","workflow-sync","workflows"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/github-workflow-sync","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/varunsridharan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["varunsridharan"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"custom":["https://paypal.me/varunsridharan23","https://www.buymeacoffee.com/varunsridharan"]}},"created_at":"2020-06-24T00:35:12.000Z","updated_at":"2025-03-27T08:54:36.000Z","dependencies_parsed_at":"2024-06-19T00:18:52.551Z","dependency_job_id":"34109f8d-a04e-4ecd-bf7d-251455c163be","html_url":"https://github.com/varunsridharan/action-github-workflow-sync","commit_stats":{"total_commits":57,"total_committers":6,"mean_commits":9.5,"dds":0.3157894736842105,"last_synced_commit":"20b2073067977c66e380718854341a61c448ac54"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Faction-github-workflow-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Faction-github-workflow-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Faction-github-workflow-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/varunsridharan%2Faction-github-workflow-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/varunsridharan","download_url":"https://codeload.github.com/varunsridharan/action-github-workflow-sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247492513,"owners_count":20947544,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-action","github-action-docker","github-action-workflow","github-action-workflow-sync","github-actions","github-workflow","github-workflows","sync","vs-github-action","workflow","workflow-sync","workflows"],"created_at":"2024-10-03T11:59:06.680Z","updated_at":"2025-04-06T14:11:36.428Z","avatar_url":"https://github.com/varunsridharan.png","language":"JavaScript","funding_links":["https://github.com/sponsors/varunsridharan","https://paypal.me/varunsridharan23","https://www.buymeacoffee.com/varunsridharan"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://cdn.svarun.dev/gh/actions-small.png\" width=\"150px\"/\u003e\u003c/p\u003e\n\n# Github Workflow Sync - ***Github Action***\nGithub Action To Sync Github Action's Workflow Files Across Repositories \n\n![https://cdn.svarun.dev/gh/varunsridharan/action-github-workflow-sync/action-banner.jpg](https://cdn.svarun.dev/gh/varunsridharan/action-github-workflow-sync/action-banner.jpg)\n\n## Use Case 🤔 ?\n_This Github Action can come in handy when you have lot of projects like i do._\n_where in some case certain projects users action workflow which are common across projects._\n_Example : [Project 1][project1] \u0026 [Project 2][project2] it can be pain to keep all the workflow updated with Github Action's Module's version._\n\nThis also isn't limited to Github Action yaml files - another use case could be keeping the `.editorconfig`, `LICENSE`, `tsconfig.json`, `tslint.json`, `.gitignore`, etc. in sync across all your repositories.\n\n\u003e_Here where this action comes in and reduces your stress 😉 it can update all your repository actions file based on the config provided_ \n\n## ⚙️ Configuration\n\n| **Argument** | Defaults | Description |\n| --- | :---: | :---: | \n| `GITHUB_TOKEN` | - | **Required** Token to use to get repos and write secrets. `${{secrets.GITHUB_TOKEN}}` will not work. instead **Personal Access Token Required*** |\n| `GIT_URL` | github.com | URL for the instance of github, where repositories should be searched for. Change if using a GHES instance. |\n| `REPOSITORIES` | - | **Required** New line deliminated regex expressions to select repositories. Repositires are limited to those in whcich the token user is an owner or collaborator. |\n| `WORKFLOW_FILES` | - | **Required** New line deliminated regex expressions. workflow files to be copied to provided repositores |\n| `DRY_RUN` | ***false*** | Run everything except for nothing will be pushed. |\n| `WORKFLOW_FILES_DIR` | ***workflows*** | Local Path Where Common Workflow Files Are Located ***Eg : `workflows`*** |\n| `AUTO_CREATE_NEW_BRANCH` | ***false*** | Auto create new brach in a repository if the branch dose not exists |\n| `COMMIT_EACH_FILE` | ***false*** | if you need to keep track of each file's commit history separate then set it to true |\n| `PULL_REQUEST` | **false** | Set to `true` if you want the changes to be pushed via pull request. |\n| `SKIP_CI` | **false** | Set to `true` if you want skip all automations inside target repository. |\n| `COMMIT_MESSAGE` | **false** | You can provide your custom commit message. |\n| `RETRY_MODE` | **true** | Enable retry and throttling octokit plugins to avoid secondary rate limits on github content creation. |\n\n### Personal Access Token Scope\n#### [Github Personal Token](https://github.com/settings/tokens/new?description=gh-workflow-sync)  \u003csmall\u003e Is required with the below scope \u003c/small\u003e\n\n![https://cdn.svarun.dev/gh/varunsridharan/action-github-workflow-sync/scope.jpg](https://cdn.svarun.dev/gh/varunsridharan/action-github-workflow-sync/scope.jpg)\n\n\u003e ℹ️ Full ***Repo*** is only required when you need to update private repository\n\u003e if your are updating only public repository then just select `public_repo` inside ***repo*** scope\n\n***[Click Here To Generate A Token](https://github.com/settings/tokens/new?description=gh-workflow-sync)***\n\n---\n\n### `REPOSITORIES` Configuration Examples\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eRepository With Default Brach\u003c/strong\u003e\u003c/summary\u003e\n\n```yaml\nREPOSITORIES: |\n    username/repo\n    username/repo2\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eRepositry With Custom Branch\u003c/strong\u003e\u003c/summary\u003e\n\n```yaml\nREPOSITORIES: |\n    username/repo@dev\n    username/repo1@dev2\n```\n\u003e You Can also have same repository multiple times if you provide different branch name\n\u003c/details\u003e\n\n---\n\n### `WORKFLOW_FILES` Configuration Examples\n\n1. If you use `=` as a file seperator `file1.md=myfile.md` then `file1` from the current repository will be copied to remote repository with the name of `myfile.md`\n1. If you use `!=` as a file seperator `file1.md!=myfile.md` then `file1` from the current repository will be copied to remote repository with the name of `myfile.md` only if `myfile.md` already not exists in the remote repository\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eFiles - Source \u0026 Destination File Without Custom Name\u003c/strong\u003e\u003c/summary\u003e\n\n```yaml\nWORKFLOW_FILES: |\n    dependabot.yml\n    .github/settings.yml\n```\n\u003e **dependabot.yml** will save in root folder in the repository\n\u003e\n\u003e **.github/settings.yml** will save in `.github` in the repository\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eFiles - Source File In Root \u0026 Destination File In Custom Location\u003c/strong\u003e\u003c/summary\u003e\n\n```yaml\nWORKFLOW_FILES: |\n    hello-bot.yml=.github/\n    pr-bot.yml=.github/pull-request.yml\n```\n\u003e **hello-bot.yml** will save in `.github` in the repository with the same name\n\u003e\n\u003e **pr-bot.yml** will save in `.github` in the repository with the name `pull-request.yml`\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eFolders - Source \u0026 Destination Folders Without Custom Name\u003c/strong\u003e\u003c/summary\u003e\n\n```yaml\nWORKFLOW_FILES: |\n    folder1\n    .github/folder2\n```\n\u003e **folder1** will save in root folder in the repository\n\u003e\n\u003e **.github/folder2** will save in `.github` in the repository\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cstrong\u003eFolders - Source \u0026 Destination Folders With Custom Name\u003c/strong\u003e\u003c/summary\u003e\n\n```yaml\nWORKFLOW_FILES: |\n    folder1=./save-to-folder\n    .github/folder2=custom-folder/save-to-folder2\n```\n\u003e **folder1** will save inside `REPOSITORY ROOT` in the name of `save-to-folder`\n\u003e\n\u003e **.github/folder2** will save inside `custom-folder` in the name of `save-to-folder2`\n\n\u003c/details\u003e\n\n---\n\n## How Files Sync Work ?\nBefore copying the **WORKFLOW_FILES** from the source to destination. this action will provide some flexibility.\nthis searchs for a file in various locations for example lets take `settings.yml` as the file that you want to sync for multiple repository\n\n#### Below are the locations that this action search for the file/folder\n* `./{OWNER}/{REPO_NAME}/workflows/{filename}`\n* `./{OWNER}/workflows/{filename}`\n* `./{WORKFLOW_FILES_DIR}/{filename}`\n* `./.github/workflows/{filename}`\n* `./{OWNER}/{REPO_NAME}/{filename}`\n* `./{OWNER}/{filename}`\n* `./{filename}`\n\n\u003e if the `settings.yml` is found inside `workflows` folder then the destination is automaitcally forced to `.github/workflows` in the destination repo\n\u003e\n\u003e if the `settings.yml` is outside of `workflows` folder then the destination then its copied to the destination\n\n### How this can be useful ?\nLets assume that you want to maintain all the common github files in a single repository and suddenly a repository needs a single file to be changed in that case instead of editing the action yml file. you can just create a folder like `{REPO_OWNER}/{REPO_NAME}/{FILE}` to copy the overriden file to the destination\n\n\n## 🚀 Usage\n\n### Step 1\nCreate a [New Repository](https://github.com/new) or use our [Repository Template](https://github.com/varunsridharan/template-github-workflow-sync/generate) \n\n### Step 2\nif you have used our template repository then edit the file inside `.github/workflows/workflow-sync.yml`\n\nOR\n\nCreate a new file in `.github/workflows/` named **workflow-sync.yml** and copy \u0026 paste the below file content\n\n#### `workflow-sync.yml` content\n```yaml\nname: Workflow Sync\n\non:\n  push:\n    branches:\n      - master\nenv:\n  DRY_RUN: false\n  REPOSITORIES: |\n  \n  WORKFLOW_FILES: |\n\njobs:\n  Github_Workflow_Sync:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Fetching Local Repository\n        uses: actions/checkout@master\n      - name: Running Workflow Sync\n        uses: varunsridharan/action-github-workflow-sync@main\n        with:\n          DRY_RUN: ${{ env.DRY_RUN }}\n          REPOSITORIES: ${{ env.REPOSITORIES }}\n          WORKFLOW_FILES: ${{ env.WORKFLOW_FILES }}\n          GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}\n\n```\n\n## Troubleshooting\n\n### Spacing\nSpacing around the equal sign is important. For example, this will not work:\n\n```yaml\nWORKFLOW_FILES: |\n  folder/file-sync.yml = folder/test.txt\n```\n\nIt passes to the shell file 3 distinct objects\n\n* folder/file-sync.ymll\n* =\n* folder/test.txt\n\ninstead of 1 object\n\n* folder/file-sync.yml = folder/test.txt\n\nand there is nothing I can do in code to make up for that\n\n### Slashes\n\nYou do not need (nor want) leading `/` for the file path on either side of the equal sign\n\nThe only time you need `/` trailing is for folder copies. \nWhile a file copy will technically still work with a leading `/`, a folder copy will not\n\n---\n\n## 📝 Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n[Checkout CHANGELOG.md](/CHANGELOG.md)\n\n## 🤝 Contributing\nIf you would like to help, please take a look at the list of [issues](issues/).\n\n## 💰 Sponsor\n[I][twitter] fell in love with open-source in 2013 and there has been no looking back since! You can read more about me [here][website].\nIf you, or your company, use any of my projects or like what I’m doing, kindly consider backing me. I'm in this for the long run.\n\n- ☕ How about we get to know each other over coffee? Buy me a cup for just [**$9.99**][buymeacoffee]\n- ☕️☕️ How about buying me just 2 cups of coffee each month? You can do that for as little as [**$9.99**][buymeacoffee]\n- 🔰         We love bettering open-source projects. Support 1-hour of open-source maintenance for [**$24.99 one-time?**][paypal]\n- 🚀         Love open-source tools? Me too! How about supporting one hour of open-source development for just [**$49.99 one-time ?**][paypal]\n\n## 📝 License \u0026 Conduct\n- [**MIT license**](LICENSE) © [Varun Sridharan](website)\n\n\n## 📣 Feedback\n- ⭐ This repository if this project helped you! :wink:\n- Create An [🔧 Issue](issues/) if you need help / found a bug\n\n## Connect \u0026 Say 👋\n- **Follow** me on [👨‍💻 Github][github] and stay updated on free and open-source software\n- **Follow** me on [🐦 Twitter][twitter] to get updates on my latest open source projects\n- **Message** me on [📠 Telegram][telegram]\n- **Follow** my pet on [Instagram][sofythelabrador] for some _dog-tastic_ updates!\n\n---\n\n\u003cp align=\"center\"\u003e\n\u003ci\u003eBuilt With ♥ By \u003ca href=\"https://go.svarun.dev/twitter\"  target=\"_blank\" rel=\"noopener noreferrer\"\u003eVarun Sridharan\u003c/a\u003e 🇮🇳 \u003c/i\u003e\n\u003c/p\u003e\n\n---\n\n\u003c!-- Personl Links --\u003e\n[project1]: https://github.com/varunsridharan/wc-product-subtitle/blob/master/.github/workflows/push-to-master.yml\n[project2]: https://github.com/varunsridharan/sku-shortlink-for-woocommerce/blob/master/.github/workflows/push-to-master.yml\n[paypal]: https://go.svarun.dev/paypal\n[buymeacoffee]: https://go.svarun.dev/buymeacoffee\n[sofythelabrador]: https://www.instagram.com/sofythelabrador/\n[github]: https://go.svarun.dev/github/\n[twitter]: https://go.svarun.dev/twitter/\n[telegram]: https://go.svarun.dev/telegram/\n[email]: https://go.svarun.dev/contact/email/\n[website]: https://go.svarun.dev/website/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunsridharan%2Faction-github-workflow-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarunsridharan%2Faction-github-workflow-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunsridharan%2Faction-github-workflow-sync/lists"}