Skip to content

Commit

Permalink
chore: comment preview links/qrcodes on each PR after EAS update (#921)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mazuh authored Jan 9, 2023
1 parent 15a19bb commit de86ba5
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion .github/workflows/expo-eas-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,28 @@ jobs:
with:
script: return `${{ inputs.message }}`.replaceAll('"',"'")
result-encoding: string
- run: eas update --branch ${{ inputs.channel }} --message "${{ steps.sanitise-double-quotes.outputs.result }}"
- name: EAS update
id: eas-update
run: |
EAS_UPDATED_OUTPUT="$(eas update --branch ${{ inputs.channel }} --message '${{ steps.sanitise-double-quotes.outputs.result }}' --non-interactive --json | tr '\n' ' ')"
echo "$EAS_UPDATED_OUTPUT"
echo "::set-output name=easUpdateOutput::$EAS_UPDATED_OUTPUT"
- name: Build comment with preview links
id: build-comment
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const rawEasUpdateOutput = `${{ steps.eas-update.outputs.easUpdateOutput }}`
const easUpdateOutput = JSON.parse(rawEasUpdateOutput)
const previewLink = `https://expo.dev/accounts/nearform/projects/optic-expo/updates/${easUpdateOutput[0].group}`
const qrCodesSections = easUpdateOutput.map(
preview =>
`${preview.platform}: <br/> <img src='https://qr.expo.dev/eas-update?updateId=${preview.id}&amp;appScheme=exp&amp;host=u.expo.dev' alt='QR Code' />`
)
return `Preview available at ${previewLink} <br/> <br/> Or scan QR Codes... <br/> <br/> ${qrCodesSections.join('<br/><br/>')}}`
- name: Comment preview link
uses: expo/expo-github-action/preview-comment@v7
with:
channel: pr-${{ github.event.number }}
message: ${{ steps.build-comment.outputs.result }}

0 comments on commit de86ba5

Please sign in to comment.