-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
70 lines (65 loc) · 2.28 KB
/
action.yml
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
name: 'dbt-bouncer'
description: 'Configure and enforce conventions for your dbt project.'
inputs:
config-file:
default: 'dbt-bouncer.yml'
description: 'Location of the YML config file.'
required: false
output-file:
default: ''
description: 'Name of the json file where check metadata will be saved.'
required: false
send-pr-comment:
default: 'true'
description: |
true: Send a comment to the GitHub PR with a list of failed checks.
false: Do not send a comment.
required: false
verbose:
default: 'false'
description: Run dbt-bouncer in verbose mode.
required: false
runs:
using: composite
steps:
- name: Assemble `output-file` parameter
id: assemble-output-file-param
shell: bash
run: >
if [[ "${{ inputs.output-file }}" = "" ]]; then
echo "output-file-param=" >> $GITHUB_OUTPUT
else
echo "output-file-param=--output-file /app/${{ inputs.output-file }}" >> $GITHUB_OUTPUT
fi
- name: Assemble `verbose` parameter
id: assemble-verbose-param
shell: bash
run: >
if [[ "${{ inputs.verbose }}" = "false" ]]; then
echo "verbose-param=" >> $GITHUB_OUTPUT
else
echo "verbose-param=-v" >> $GITHUB_OUTPUT
fi
- name: Run dbt-bouncer
id: run-dbt-bouncer
shell: bash
run: >
docker run --rm \
--env GITHUB_REF='${{ github.ref }}' \
--env GITHUB_REPOSITORY='${{ github.repository }}' \
--env GITHUB_RUN_ID='${{ github.run_id }}' \
--env GITHUB_TOKEN='${{ github.token }}' \
--volume "$GITHUB_WORKSPACE":/app \
ghcr.io/godatadriven/dbt-bouncer:v0.0.0 \
--config-file /app/${{ inputs.config-file }} \
--create-pr-comment-file ${{ inputs.send-pr-comment }} \
${{ steps.assemble-output-file-param.outputs.output-file-param }} ${{ steps.assemble-verbose-param.outputs.verbose-param }}
- name: Send PR comment
if: always() && inputs.send-pr-comment == 'true' && steps.run-dbt-bouncer.outcome != 'success'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: >
gh pr comment ${{ github.event.number }} \
--repo ${{ github.repository }} \
--body-file github-comment.md