You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the only customization possible is via the global env property, but unfortunately this isn't available everywhere in the workflow and can't be used to customize a workflow template.
I foresee a few ways to reuse existing templates:
Plain merging of a local template (e.g. .github/workflows-ghat/ci.yml) with the remote template
on:
- pushjobs:
test:
name: Let's test stuffapply: fregante/ghat/templates/node#jobs.test # It would only merge the specific jobs.test sectionbuild:
needs: teststeps:
- run: echo My other steps
An advanced way to customize the templates
For example it could apply some ENVs at merge time like GitHub does with the $default-branch variable:
because env doesn't support arrays for example, and can't be used in strategy.matrix
some conditions could be pre-evaluated, so that whole steps/jobs could be dropped/added at merge time instead of just being silenced at run time.
Alternative idea: The "local template" could just be a .js module that can do anything:
// In ghatrequire('./.github/workflows/ghat.js');// if it exists
// In local .github/workflows/ghat.jsconstghat=require('ghat');(async()=>{constmyWorkflow=awaitghat.get('fregante/ghatemplates/file.yml');myWorkflow.name='Coolio';awaitghat.save('ci.yml',myWorkflow);})();
Currently the only customization possible is via the global
env
property, but unfortunately this isn't available everywhere in the workflow and can't be used to customize a workflow template.I foresee a few ways to reuse existing templates:
Plain merging of a local template (e.g.
.github/workflows-ghat/ci.yml
) with the remote templateImporting single jobs
An advanced way to customize the templates
For example it could apply some ENVs at merge time like GitHub does with the
$default-branch
variable:env
doesn't support arrays for example, and can't be used instrategy.matrix
Initially defined in sindresorhus/project-ideas#128
The text was updated successfully, but these errors were encountered: