feat: add optional preprod preview URL to PR comments#73
feat: add optional preprod preview URL to PR comments#73souhaibparcellab wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an optional feature to include a preprod preview URL in PR comments for applications that have preprod preview environments. The change is opt-in via a new boolean input parameter that defaults to false, ensuring backward compatibility with existing workflows.
Changes:
- Add
PREPROD_PREVIEW_ENABLEDboolean input parameter (defaults to false) - Introduce a new build step to construct the PR comment message dynamically based on the parameter value
- Refactor the PR commenting logic to use the dynamically built message
| @@ -87,9 +92,20 @@ jobs: | |||
| if: ${{ inputs.GHA_TRIGGER_EVENT != 'synchronize' }} | |||
There was a problem hiding this comment.
The comment-pr job is missing required permissions to comment on pull requests. The thollander/actions-comment-pull-request action requires pull-requests: write permission. Add a permissions block to this job similar to what exists in other workflows (e.g., pr.yaml:21-23).
| if: ${{ inputs.GHA_TRIGGER_EVENT != 'synchronize' }} | |
| if: ${{ inputs.GHA_TRIGGER_EVENT != 'synchronize' }} | |
| permissions: | |
| pull-requests: write |
| id: build-message | ||
| run: | | ||
| MESSAGE="Preview URL: https://${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev" | ||
| if [ "${{ inputs.PREPROD_PREVIEW_ENABLED }}" == "true" ]; then |
There was a problem hiding this comment.
Use single equals sign for string comparison to be consistent with the established convention in this codebase. See kubernetes.yaml:206 which uses the pattern if [ "$VAR" = "true" ]; then for boolean string comparison.
| MESSAGE="${MESSAGE} | ||
| Preview URL (preprod): https://${{ inputs.APPLICATION_NAME }}-preprod-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev" | ||
| fi | ||
| MESSAGE="${MESSAGE} | ||
| Preview Argo App: https://argocd.staging.parcellab.dev/applications/argocd/${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}" |
There was a problem hiding this comment.
The multiline string concatenation includes leading whitespace that will appear in the PR comment. The indentation before "Preview URL (preprod)" on line 101 will be preserved in the output. Consider removing the leading spaces to ensure consistent formatting of the PR comment, or ensure this indentation is intentional.
| MESSAGE="${MESSAGE} | |
| Preview URL (preprod): https://${{ inputs.APPLICATION_NAME }}-preprod-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev" | |
| fi | |
| MESSAGE="${MESSAGE} | |
| Preview Argo App: https://argocd.staging.parcellab.dev/applications/argocd/${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}" | |
| MESSAGE="${MESSAGE}"$'\n'"Preview URL (preprod): https://${{ inputs.APPLICATION_NAME }}-preprod-preview-${{ inputs.PR_NUMBER }}.staging.parcellab.dev" | |
| fi | |
| MESSAGE="${MESSAGE}"$'\n'"Preview Argo App: https://argocd.staging.parcellab.dev/applications/argocd/${{ inputs.APPLICATION_NAME }}-preview-${{ inputs.PR_NUMBER }}" |
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.
4c15bdd to
f23bb82
Compare
There was a problem hiding this comment.
@souhaibparcellab preprod word should be a part of APPLICATION_NAME input rather than constitute a special case in the reusable workflow.
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.