Skip to content

spike: style poc improvements #395

spike: style poc improvements

spike: style poc improvements #395

Workflow file for this run

name: Web App - PR Preview
on:
pull_request:
branches:
- main
paths:
- "web-app/**"
- "functions/**"
- ".github/workflows/web-*.yml"
jobs:
deploy-web-app:
uses: ./.github/workflows/web-app-deployer.yml
with:
FIREBASE_PROJECT: dev
PREVIEW_DEPLOYMENT: true
FEED_SUBMIT_GOOGLE_SHEET_ID: "1iXwux9hM4p5Li1EGgwx-8hU3sMDnF15yTflqmGjiZqE"
OP_SLACK_WEBHOOK_URL: "op://rbiv7rvkkrsdlpcrz3bmv7nmcu/wm52iemzzm2cwfaoakwaufthuq/password"
PREVIEW_HOST_NAME: "pr-${{ github.event.number }}"
secrets: inherit
update-pr-comment:
name: Update PR comments
runs-on: ubuntu-latest
needs: [ deploy-web-app ]
env:
PR_ID: ${{ github.event.number }}
steps:
- name: Check for Existing Comment
id: check-comment
run: |
HOSTING_URL=$(echo "$HOSTING_URL_64" | base64 -d)
COMMENT="Preview Firebase Hosting URL: $HOSTING_URL"
echo "PR comment: $COMMENT"
COMMENTS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/issues/${{ env.PR_ID }}/comments")
JQ_CHECK=`echo "$COMMENTS" | jq -r ".[] | select(.body == \"$COMMENT\")"`
if [ -z "$JQ_CHECK" ]; then
echo "Comment does not exist."
echo "comment_exists=false" >> $GITHUB_OUTPUT
else
echo "Comment already exists."
echo "comment_exists=true" >> $GITHUB_OUTPUT
fi
env:
HOSTING_URL_64: ${{ needs.deploy-web-app.outputs.hosting_url }}
- name: Comment on PR with Hosting URL (PR Preview)
if: steps.check-comment.outputs.comment_exists == 'false'
run: |
HOSTING_URL=$(echo "$HOSTING_URL_64" | base64 -d)
COMMENT="Preview Firebase Hosting URL: $HOSTING_URL"
echo "$COMMENT" > comment.txt
curl -d "{\"body\":\"$(cat comment.txt)\"}" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/json" -X POST "https://api.github.com/repos/${{ github.repository }}/issues/${{ env.PR_ID }}/comments"
env:
HOSTING_URL_64: ${{ needs.deploy-web-app.outputs.hosting_url }}