fregante/ghat

Allow definition/setup via local template instead of cli

開放

#4 建立於 2020年11月8日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (9 個分叉)github user discovery
enhancementhelp wanted

倉庫指標

星標
 (264 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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

# Fetch template
apply: fregante/ghat/templates/node

# Overwrite existing `on` property with
on:
  - push

Importing single jobs

on:
  - push
jobs:
  test:
    name: Let's test stuff
    apply: fregante/ghat/templates/node#jobs.test # It would only merge the specific jobs.test section
  build:
    needs: test
    steps:
      - 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.

Initially defined in https://github.com/sindresorhus/project-ideas/issues/128

貢獻者指南