Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update artifacts GitHub actions to v4 #43

Merged
merged 8 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/ephemeral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
"github-token": ${{ toJSON(secrets.GITHUB_TOKEN) }},
"state-backend": "ephemeral",
"state-action": "start",
"include-preview": "true",
"skip-ephemeral-stop": "true",
"preview-cmd": ${{ toJSON(env.PREVIEW_CMD) }},
"lifetime": 5,
Expand All @@ -31,7 +32,7 @@ jobs:
awslocal sqs create-queue --queue-name=test-queue
echo "Deploy is done."

- name: Assertion step
- name: Assert mailhog is installed
run: |
sudo apt-get install jq jo
response=$(curl ${AWS_ENDPOINT_URL}/_localstack/extensions/list)
Expand All @@ -44,6 +45,24 @@ jobs:
exit 1
fi

- name: Check PR Comments for preview text
id: check-comments
run: |
PR_NUMBER=${{ github.event.pull_request.number }}
TEXT_TO_FIND="Preview for this PR"

# Fetch PR comments
comments=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments)

# Check if the specific text is in the comments
if echo "$comments" | jq -e --arg text "$TEXT_TO_FIND" '.[] | select(.body | contains($text))' > /dev/null; then
echo "Found the text in PR comments."
else
echo "Text not found in PR comments."
exit 1
fi
env:
GH_TOKEN: ${{ github.token }}

# We want explicit shutdown
- name: Shutdown ephemeral instance
Expand Down
4 changes: 2 additions & 2 deletions ephemeral/shutdown/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ runs:
using: composite
steps:
- name: Download PR artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pr
name: pr-id

- name: Load the PR ID
id: pr
Expand Down
8 changes: 4 additions & 4 deletions ephemeral/startup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ runs:
}

- name: Download PR artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: pr
name: pr-id

- name: Setup preview name
shell: bash
Expand Down Expand Up @@ -102,9 +102,9 @@ runs:
echo "AWS_ENDPOINT_URL=$endpointUrl" >> $GITHUB_ENV

- name: Upload preview instance URL
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pr
name: preview-instance-url
lukqw marked this conversation as resolved.
Show resolved Hide resolved
path: ./ls-preview-url.txt

- name: Run preview deployment
Expand Down
23 changes: 20 additions & 3 deletions finish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ runs:
# Try to get pr artifact from current workflow
- name: Download current PR artifact
id: get-pr-artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: pr
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
lukqw marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ steps.get-pr-artifact.outcome == 'failure' }}
with:
name: pr
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 }}
lukqw marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -40,6 +40,23 @@ runs:
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
Expand Down
4 changes: 2 additions & 2 deletions local/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
- name: Download current workflow's Local State artifact
id: get-state-artifact
if: ${{ inputs.action == 'load' }}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: ${{ inputs.name }}
Expand Down Expand Up @@ -48,7 +48,7 @@ runs:
ACTION: "${{ inputs.action }}"

- name: Upload LocalStack State
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ inputs.action == 'save' }}
with:
name: ${{ inputs.name }}
Expand Down
4 changes: 2 additions & 2 deletions prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ runs:
run: echo ${{ github.event.number }} > ./pr-id.txt

- name: Upload PR number
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pr
name: pr-id
path: ./pr-id.txt

- name: Create initial PR comment
Expand Down
Loading