DEV Community

loading...
Cover image for Github Action : Workflow Files Sync

Github Action : Workflow Files Sync

varunsridharan profile image Varun Sridharan ・2 min read

This Github Action can come in handy when you have lot of projects like i do. where in some case certain projects users action workflow which are common across projects. Example : Project 1 & Project 2 it can be pain to keep all the workflow updated with Github Action's Module's version.

This also isn't limited to Github Action yaml files.
Another use case could be keeping the .editorconfig, LICENSE, tsconfig.json, tslint.json, .gitignore, azure-pieplines.yml, etc. in sync across all your repositories.

Here where this action comes in and reduces your stress 😉 it can update all your repository actions file based on the config provided

How Files Sync Work ?

Before copying the WORKFLOW_FILES from the source to destination. this action will provide some flexibility. this searches for a file in various locations for example lets take settings.yml as the file that you want to sync for multiple repository

Below are the locations that this action search for the file/folder

  • ./{OWNER}/{REPO_NAME}/workflows/{filename}
  • ./{OWNER}/workflows/{filename}
  • ./{WORKFLOW_FILES_DIR}/{filename}
  • ./.github/workflows/{filename}
  • ./{OWNER}/{REPO_NAME}/{filename}
  • ./{OWNER}/{filename}
  • ./{filename}

if the settings.yml is found inside workflows folder then the destination is automatically forced to .github/workflows in the destination repo

if the settings.yml is outside of workflows folder then the destination then its copied to the destination

How this can be useful ?

Lets 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

GitHub logo varunsridharan / action-github-workflow-sync

Github Action To Sync Github Action's Workflow Files Across Repositories

Github Workflow Sync - Github Action

Github Action To Sync Github Action's Workflow Files Across Repositories

https://cdn.svarun.dev/gh/varunsridharan/action-github-workflow-sync/action-banner.jpg

Use Case 🤔 ?

This Github Action can come in handy when you have lot of projects like i do. where in some case certain projects users action workflow which are common across projects. Example : Project 1 & Project 2 it can be pain to keep all the workflow updated with Github Action's Module's version.

This also isn't limited to Github Action yaml files - another use case could be keeping the .editorconfig, LICENSE, tsconfig.json, tslint.json, .gitignore, azure-pieplines.yml, etc. in sync across all your repositories.

Here where this action comes in and reduces your stress 😉 it can update all your repository actions file based on the config provided

⚙️ Configuration
















Argument Defaults Description
GITHUB_TOKEN -
Required Token to use to get repos and write secrets. ${{secrets.GITHUB_TOKEN}}




Discussion (0)

pic
Editor guide