Skip to content

Commit aadd2c7

Browse files
alexrashedlukqw
andauthored
update artifacts GitHub actions to v4 (#43)
Co-authored-by: lukqw <[email protected]>
1 parent a9b3e54 commit aadd2c7

File tree

6 files changed

+50
-14
lines changed

6 files changed

+50
-14
lines changed

.github/workflows/ephemeral.yml

+20-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
"github-token": ${{ toJSON(secrets.GITHUB_TOKEN) }},
1919
"state-backend": "ephemeral",
2020
"state-action": "start",
21+
"include-preview": "true",
2122
"skip-ephemeral-stop": "true",
2223
"preview-cmd": ${{ toJSON(env.PREVIEW_CMD) }},
2324
"lifetime": 5,
@@ -31,7 +32,7 @@ jobs:
3132
awslocal sqs create-queue --queue-name=test-queue
3233
echo "Deploy is done."
3334
34-
- name: Assertion step
35+
- name: Assert mailhog is installed
3536
run: |
3637
sudo apt-get install jq jo
3738
response=$(curl ${AWS_ENDPOINT_URL}/_localstack/extensions/list)
@@ -44,6 +45,24 @@ jobs:
4445
exit 1
4546
fi
4647
48+
- name: Check PR Comments for preview text
49+
id: check-comments
50+
run: |
51+
PR_NUMBER=${{ github.event.pull_request.number }}
52+
TEXT_TO_FIND="Preview for this PR"
53+
54+
# Fetch PR comments
55+
comments=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments)
56+
57+
# Check if the specific text is in the comments
58+
if echo "$comments" | jq -e --arg text "$TEXT_TO_FIND" '.[] | select(.body | contains($text))' > /dev/null; then
59+
echo "Found the text in PR comments."
60+
else
61+
echo "Text not found in PR comments."
62+
exit 1
63+
fi
64+
env:
65+
GH_TOKEN: ${{ github.token }}
4766

4867
# We want explicit shutdown
4968
- name: Shutdown ephemeral instance

ephemeral/shutdown/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ runs:
1313
using: composite
1414
steps:
1515
- name: Download PR artifact
16-
uses: actions/download-artifact@v3
16+
uses: actions/download-artifact@v4
1717
with:
18-
name: pr
18+
name: pr-id
1919

2020
- name: Load the PR ID
2121
id: pr

ephemeral/startup/action.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ runs:
5151
}
5252
5353
- name: Download PR artifact
54-
uses: actions/download-artifact@v3
54+
uses: actions/download-artifact@v4
5555
with:
56-
name: pr
56+
name: pr-id
5757

5858
- name: Setup preview name
5959
shell: bash
@@ -102,9 +102,9 @@ runs:
102102
echo "AWS_ENDPOINT_URL=$endpointUrl" >> $GITHUB_ENV
103103
104104
- name: Upload preview instance URL
105-
uses: actions/upload-artifact@v3
105+
uses: actions/upload-artifact@v4
106106
with:
107-
name: pr
107+
name: preview-instance-url
108108
path: ./ls-preview-url.txt
109109

110110
- name: Run preview deployment

finish/action.yml

+20-3
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ runs:
2020
# Try to get pr artifact from current workflow
2121
- name: Download current PR artifact
2222
id: get-pr-artifact
23-
uses: actions/download-artifact@v3
23+
uses: actions/download-artifact@v4
2424
continue-on-error: true
2525
with:
26-
name: pr
26+
name: pr-id
2727

2828
# If the above fails, try to get the latest pr artifact from the PR related workflows
2929
- name: Download latest PR artifact
3030
uses: dawidd6/action-download-artifact@v6
3131
if: ${{ steps.get-pr-artifact.outcome == 'failure' }}
3232
with:
33-
name: pr
33+
name: pr-id
3434
pr: ${{ github.event.pull_request.number }}
3535
# Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
3636
workflow: ${{ env.PR_ARTIFACT_WORKFLOW }}
@@ -40,6 +40,23 @@ runs:
4040
shell: bash
4141
run: echo "pr_id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
4242

43+
- name: Download preview instance URL
44+
id: get-preview-instance-url-artifact
45+
if: inputs.include-preview
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: preview-instance-url
49+
50+
# If the above fails, try to get the latest pr artifact from the PR related workflows
51+
- name: Download latest PR artifact
52+
uses: dawidd6/action-download-artifact@v6
53+
if: ${{ steps.get-preview-instance-url-artifact.outcome == 'failure' }}
54+
with:
55+
name: preview-instance-url
56+
pr: ${{ github.event.pull_request.number }}
57+
# Can be ID or workflow file name, if empty falls back to the latest successful run of the current workflow
58+
workflow: ${{ env.PR_ARTIFACT_WORKFLOW }}
59+
4360
- name: Load the Ephemeral Instance URL
4461
shell: bash
4562
if: inputs.include-preview

local/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
- name: Download current workflow's Local State artifact
1818
id: get-state-artifact
1919
if: ${{ inputs.action == 'load' }}
20-
uses: actions/download-artifact@v3
20+
uses: actions/download-artifact@v4
2121
continue-on-error: true
2222
with:
2323
name: ${{ inputs.name }}
@@ -48,7 +48,7 @@ runs:
4848
ACTION: "${{ inputs.action }}"
4949
5050
- name: Upload LocalStack State
51-
uses: actions/upload-artifact@v3
51+
uses: actions/upload-artifact@v4
5252
if: ${{ inputs.action == 'save' }}
5353
with:
5454
name: ${{ inputs.name }}

prepare/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ runs:
1616
run: echo ${{ github.event.number }} > ./pr-id.txt
1717

1818
- name: Upload PR number
19-
uses: actions/upload-artifact@v3
19+
uses: actions/upload-artifact@v4
2020
with:
21-
name: pr
21+
name: pr-id
2222
path: ./pr-id.txt
2323

2424
- name: Create initial PR comment

0 commit comments

Comments
 (0)