Skip to content

Commit 4c15bdd

Browse files
feat: add optional preprod preview URL to PR comments
Add PREPROD_PREVIEW_ENABLED input parameter that allows applications to include preprod preview URL in the PR comment. This is opt-in and defaults to false to maintain backward compatibility.
1 parent 35efef5 commit 4c15bdd

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/preview.build-image.yaml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ on:
2525
description: If provided, downloads a previously uploaded artifact (has to be in the same workflow). Both artifactPath and artifactName have to be passed.
2626
default: ""
2727
type: string
28+
PREPROD_PREVIEW_ENABLED:
29+
description: Whether to include preprod preview URL in comment (for apps with preprod preview environments)
30+
required: false
31+
type: boolean
32+
default: false
2833
secrets:
2934
AWS_ROLE_TO_ASSUME:
3035
required: true
@@ -87,9 +92,20 @@ jobs:
8792
if: ${{ inputs.GHA_TRIGGER_EVENT != 'synchronize' }}
8893
runs-on: ubuntu-latest
8994
steps:
95+
- name: Build comment message
96+
id: build-message
97+
run: |
98+
MESSAGE="Preview URL: https://${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev"
99+
if [ "${{ inputs.PREPROD_PREVIEW_ENABLED }}" == "true" ]; then
100+
MESSAGE="${MESSAGE}
101+
Preview URL (preprod): https://${{ inputs.APPLICATION_NAME }}-preprod-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev"
102+
fi
103+
MESSAGE="${MESSAGE}
104+
Preview Argo App: https://argocd.staging.parcellab.dev/applications/argocd/${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}"
105+
echo "message<<EOF" >> $GITHUB_OUTPUT
106+
echo "$MESSAGE" >> $GITHUB_OUTPUT
107+
echo "EOF" >> $GITHUB_OUTPUT
90108
- name: Comment PR
91109
uses: thollander/actions-comment-pull-request@v3
92110
with:
93-
message: |
94-
Preview URL: https://${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev
95-
Preview Argo App: https://argocd.staging.parcellab.dev/applications/argocd/${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}
111+
message: ${{ steps.build-message.outputs.message }}

0 commit comments

Comments
 (0)