File tree Expand file tree Collapse file tree 2 files changed +20
-11
lines changed
actions/preview_dashboards Expand file tree Collapse file tree 2 files changed +20
-11
lines changed Original file line number Diff line number Diff line change 67
67
type : boolean
68
68
required : false
69
69
# preview-specific:
70
- output :
71
- description : " Format of the output: json or yaml (default is yaml)."
72
- type : string
73
- required : false
74
- prefix :
70
+ prefix : # TODO should be replaced by automatic passing of PR number
75
71
description : If provided, it is used to prefix the dashboard preview name.
76
72
type : string
77
73
required : false
@@ -133,7 +129,6 @@ jobs:
133
129
with :
134
130
directory : ./built
135
131
project : ${{ inputs.project }}
136
- output : ${{ inputs.output }}
137
132
prefix : ${{ inputs.prefix }}
138
133
ttl : ${{ inputs.ttl }}
139
134
Original file line number Diff line number Diff line change 9
9
file :
10
10
description : Path to the file that contains the resources consumed by the command (mutually exclusive with `directory`).
11
11
required : false
12
- output :
13
- description : " Format of the output: json or yaml (default is yaml)."
14
- required : false
15
12
prefix :
16
13
description : If provided, it is used to prefix the dashboard preview name.
17
14
required : false
29
26
percli dac preview \
30
27
$([[ -n "${{ inputs.directory }}" ]] && echo "-d ${{ inputs.directory }}") \
31
28
$([[ -n "${{ inputs.file }}" ]] && echo "-f ${{ inputs.file }}") \
32
- $([[ -n "${{ inputs.output }}" ]] && echo "-o ${{ inputs.output }}") \
33
29
$([[ -n "${{ inputs.prefix }}" ]] && echo "--prefix ${{ inputs.prefix }}") \
34
30
$([[ -n "${{ inputs.project }}" ]] && echo "--project ${{ inputs.project }}") \
35
- $([[ -n "${{ inputs.ttl }}" ]] && echo "--ttl ${{ inputs.ttl }}")
31
+ $([[ -n "${{ inputs.ttl }}" ]] && echo "--ttl ${{ inputs.ttl }}") \
32
+ -o json \
33
+ > preview_output.json
36
34
shell : bash
35
+
36
+ - name : Post preview links to PR
37
+ if : ${{ github.event_name == 'pull_request' }}
38
+ uses : actions/github-script@v6
39
+ with :
40
+ script : |
41
+ const fs = require('fs');
42
+ const data = JSON.parse(fs.readFileSync('preview_output.json', 'utf8'));
43
+ const previewLinks = data.map(item => `- [${item.project}/${item.dashboard}](${item.preview})`).join('\n');
44
+ const commentBody = `### Dashboard Previews\nThe following dashboards have been deployed as previews:\n\n${previewLinks}`;
45
+ github.rest.issues.createComment({
46
+ owner: context.repo.owner,
47
+ repo: context.repo.repo,
48
+ issue_number: context.issue.number,
49
+ body: commentBody
50
+ });
You can’t perform that action at this time.
0 commit comments