action-github-workflow-sync icon indicating copy to clipboard operation
action-github-workflow-sync copied to clipboard

add support for $default-branch placeholder expansion (to copy workflows from <ORG>/.github/workflow-templates)

Open lestephane opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

I started my journey towards workflow sharing with starter workflows at https://docs.github.com/en/actions/using-workflows/creating-starter-workflows-for-your-organization, by creating files in the org .github repo's workflow-templates sub-directorywith the $default-branch placeholder.

Then later, I realized I can't use workflow-templates unless I switch to GitHub Enterprise Cloud. Which I'm not ready to do (yet). And I only have private repos in my organization.

Then I found this project, and figured this would solve my immediate problem of copying workflow files to target repositories whenever a change is pushed.

Problem: The target repositories use a mix of master and main as default branch. And I cannot change that yet.

Describe the solution you'd like Have action-github-workflow-sync replace $default-branch with the default branch name of the repository that the workflow file is being copied to. This way, I keep workflow-templates which is starter workflow friendly for the day I switch to Enterprise Cloud (which could be never), and yet the sync creates a workflow file that contains the correct default branch name on my behalf.

There is then only one source of truth for the workflows...

Describe alternatives you've considered I've considered reusable workflows, but it is not possible to call a reusable workflow in a private repository from a workflow in another private repository.

Additional context Organizations dealing only with private repositories are not well served by default when it comes to keeping workflows DRY. Making this change could help improve the situation.

lestephane avatar Jul 20 '22 14:07 lestephane

@lestephane

What i understood from your solution is that you want this action to auto find & replace $default-branch text inside the copied workflow file and update it with the proper branch name of the target repository

Is that right ?

varunsridharan avatar Jul 20 '22 15:07 varunsridharan