-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathaction.yml
More file actions
82 lines (74 loc) · 3.11 KB
/
action.yml
File metadata and controls
82 lines (74 loc) · 3.11 KB
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
name: Finish CI Build
description: Finish CI Build
inputs:
github-token:
description: 'Github token used to create PR comments'
required: true
ci-project:
description: 'Name of the CI project tracked in LocalStack Cloud'
required: false
include-preview:
description: 'Whether to include the created Ephemeral Instance URL in the PR comment'
required: false
preview-url:
description: 'The Ephmeral Instance URL to include in the PR comment'
required: false
runs:
using: composite
steps:
# Try to get pr artifact from current workflow
- name: Download current PR artifact
id: get-pr-artifact
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: pr-id
# If the above fails, try to get the latest pr artifact from the PR related workflows
- name: Download latest PR artifact
uses: dawidd6/action-download-artifact@v6
if: ${{ steps.get-pr-artifact.outcome == 'failure' }}
with:
name: pr-id
pr: ${{ github.event.pull_request.number }}
# Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
workflow: ${{ env.PR_ARTIFACT_WORKFLOW }}
- name: Load the PR ID
id: pr
shell: bash
run: echo "pr_id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
- name: Download preview instance URL
id: get-preview-instance-url-artifact
if: inputs.include-preview
uses: actions/download-artifact@v4
with:
name: preview-instance-url
# If the above fails, try to get the latest pr artifact from the PR related workflows
- name: Download latest PR artifact
uses: dawidd6/action-download-artifact@v6
if: ${{ steps.get-preview-instance-url-artifact.outcome == 'failure' }}
with:
name: preview-instance-url
pr: ${{ github.event.pull_request.number }}
# Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
workflow: ${{ env.PR_ARTIFACT_WORKFLOW }}
- name: Load the Ephemeral Instance URL
shell: bash
if: inputs.include-preview
run: |
if [[ -n "${LS_PREVIEW_URL:-${{ inputs.preview-url }}}" ]]; then
echo "LS_PREVIEW_URL=${LS_PREVIEW_URL:-${{ inputs.preview-url }}}" >> $GITHUB_ENV
elif [[ -e ls-preview-url.txt ]]; then
echo "LS_PREVIEW_URL=$(<ls-preview-url.txt)" >> $GITHUB_ENV
else
echo "LS_PREVIEW_URL=Unable to determine preview URL" >> $GITHUB_ENV
fi
- name: Update status comment
uses: actions-cool/maintain-one-comment@v3.1.1
with:
token: ${{ inputs.github-token }}
body: |
${{ inputs.ci-project && format('{0}{1}', '🚀 LocalStack Stack Insights and Cloud Pod state for this CI run: https://app.localstack.cloud/ci/', inputs.ci-project) }}
${{ inputs.include-preview && format('{0}{1}', '🚀 Preview for this PR: ', env.LS_PREVIEW_URL) }}
<!-- Sticky Pull Request Comment -->
body-include: '<!-- Sticky Pull Request Comment -->'
number: ${{ steps.pr.outputs.pr_id }}