-
Notifications
You must be signed in to change notification settings - Fork 18
/
action.yaml
63 lines (59 loc) · 1.94 KB
/
action.yaml
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
name: 'SLSA Build Provenance Action'
description: 'An action to generate SLSA build provenance for an artifact'
branding:
icon: lock
color: purple
inputs:
command:
description: 'The command to use (available options: generate)'
required: false
default: 'generate'
subcommand:
description: 'The subcommand to use when generating provenance'
required: false
default: 'files'
github_context:
description: 'internal (do not set): the "github" context object in json'
required: true
default: ${{ toJSON(github) }}
runner_context:
description: 'internal (do not set): the "runner" context object in json'
required: true
default: ${{ toJSON(runner) }}
arguments:
description: 'commandline options for the given subcommand'
required: true
install-dir:
description: 'Where to install the slsa-provenance binary'
required: false
default: '$HOME/.slsa-provenance'
runs:
using: 'composite'
steps:
- name: install binary
shell: bash
run: $GITHUB_ACTION_PATH/install-slsa-provenance.sh
env:
INSTALL_PATH: ${{ inputs.install-dir }}
- name: compose arguments
id: compose-args
shell: bash
run: |
encoded_github="$(echo ${GITHUB_CONTEXT} | base64 -w 0)"
encoded_runner="$(echo ${RUNNER_CONTEXT} | base64 -w 0)"
args=(${{ inputs.command }})
args+=(${{ inputs.subcommand }})
args+=(--github-context)
args+=("${encoded_github}")
args+=(--runner-context)
args+=("${encoded_runner}")
args+=(${{ inputs.arguments }})
echo "provenance_args=${args[@]}" >> $GITHUB_OUTPUT
env:
GITHUB_CONTEXT: ${{ inputs.github_context }}
RUNNER_CONTEXT: ${{ inputs.runner_context }}
- name: Generate provenance
shell: bash
run: $INSTALL_PATH/slsa-provenance ${{ steps.compose-args.outputs.provenance_args }}
env:
INSTALL_PATH: ${{ inputs.install-dir }}