This repository has been archived by the owner on Nov 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml.erb
93 lines (90 loc) · 3.24 KB
/
action.yml.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: 'Build GitHub Action Workflows'
description: >-
Builds workflows from templates in a specified repo. This requires
the templates cloned before running. It will also delete the
templates clone after use.
inputs:
github-token:
description: Token used to create the PR
required: true
templates-location:
description: >-
Relative path to the directory where the templates repository
was cloned. This directory will be deleted after use; do not
use it after this action has run.
required: true
templater-image-name:
description: >-
Name of the docker image to run for the templater action. It is
expected that you are logged in to the registry required to pull
this image.
required: true
extra-pr-label:
description: Label created PRs with this additional label
required: false
default: ""
create-pull-request:
description: Create a pull request after rendering templates
default: true
required: false
github-repository:
description: >-
Full name of the repository that is being rendered. e.g. smartlyio/ci-sla.
Default is the repository running the workflow
default: ${{ github.repository }}
required: false
local-render:
description: >-
Use the templates checkout directly without switching to the branch
requested by the project (usually master). Default false.
default: "false"
required: false
disable_workflows_prefix:
description: >-
Generated workflow files with this filename prefix will have the `on` section
automatically replaced with an invalid empty `on` list to prevent them from running.
Ignored if empty
default: ''
required: false
outputs:
has-changes:
description: Boolean. True if changes were made to the rendered workflows.
value: ${{ steps.collect-changes.outputs.has-changes }}
runs:
using: "composite"
steps:
- name: Fix default branch discovery for devbox
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
INPUT_GITHUB_REPOSITORY: ${{ inputs.github-repository }}
shell: bash
run: |
@import script-import-helper (script_name: "fix-branch-discovery.bash")
- name: Run templater
shell: bash
env:
INPUT_GITHUB_REPOSITORY: ${{ inputs.github-repository }}
run: |
@import script-import-helper (script_name: "run-templater.bash")
- name: Remove github-actions-templates checkout
shell: bash
# Remove templates dir so we don't leave the working tree dirty for
# commit in next step
run: |
rm -rf REMOVE-ME-github-actions-templates
- name: Disable rendered workflows if required
shell: bash
env:
INPUT_DISABLE_WORKFLOWS_PREFIX: ${{ inputs.disable_workflows_prefix }}
run: |
@import script-import-helper (script_name: "disable-workflows.bash")
- name: Push changes if required
id: collect-changes
env:
INPUT_GITHUB_REPOSITORY: ${{ inputs.github-repository }}
GITHUB_TOKEN: ${{ inputs.github-token }}
PR_LABEL: ${{ inputs.extra-pr-label }}
CREATE_PULL_REQUEST: ${{ inputs.create-pull-request }}
shell: bash
run: |
@import script-import-helper (script_name: "push-changes.bash")