/workflow-generator

Generate Github workflows based on YTT templates

Primary LanguageTypeScriptMIT LicenseMIT

Workflow Generator

Generates Github workflows based on YTT templates from a given repository.

For an example, take a look at the ytt folder and .github/workflows/main.yaml.

Usage

This action requires ytt installed in the runner, and as an output it will generate templated files that can later be pushed to a PR with another action.

For instance, to generate a PR with Github workflows that are generated with YTT templates stored in the ytt folder, using variables defined in .github/workflow-generator.yml:

generate_workflows:
  runs-on: ubuntu-latest
  steps:
    - name: Checkout git repository
      uses: actions/checkout@v2
    - uses: vmware-tanzu/carvel-setup-action@v1
      with:
        only: ytt
    - name: Generate Workflow
      uses: darioblanco/workflow-generator@main
      with:
        token: ${{ github.token }}
    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v3
      with:
        branch: ci/create-workflows
        base: main
        body: |
          Workflows automatically generated by the
          [workflow-generator](https://github.com/daroblanco/workflow-generator) GitHub action
        labels: ci
        title: Change Github Actions Workflows
        token: ${{ github.token }}

Development

Install dependencies

yarn

Compile typescript

yarn build

Lint code

yarn lint

Run the tests

yarn test