Skip to content

Instantly share code, notes, and snippets.

@nilsreichardt
Created January 30, 2022 21:07
Show Gist options
  • Save nilsreichardt/1d32be208ff34e3f35ab464841f06cb8 to your computer and use it in GitHub Desktop.
Save nilsreichardt/1d32be208ff34e3f35ab464841f06cb8 to your computer and use it in GitHub Desktop.
publishing:
scripts:
- name: Authenticate GitHub CLI
script: |
echo $GITHUB_PAT > gh_credentials.txt
gh auth login --with-token < gh_credentials.txt
rm gh_credentials.txt
- name: Post builds to GitHub PR
script: |
export APK_LINK=$(echo $FCI_ARTIFACT_LINKS | jq '.[1] | .url')
export IPA_LINK=$(echo $FCI_ARTIFACT_LINKS | jq '.[0] | .url')
export ENCODED_APK_LINK=$(jq -rn --arg x $APK_LINK '$x|@uri')
export ENCODED_IPA_LINK=$(jq -rn --arg x $IPA_LINK '$x|@uri')
read -r -d '' COMMENT << EOM
⬇️ Generated builds by [Codemagic](https://codemagic.io/app/$FCI_PROJECT_ID/build/$FCI_BUILD_ID) for commit \`$FCI_COMMIT\` ⬇️
| Android | iOS |
|:-:|:-:|
| ![image](https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=$ENCODED_APK_LINK) <br /> [Download-Link]($(echo "$APK_LINK" | tr -d '"')) | ![image](https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=$ENCODED_IPA_LINK) <br /> [Download-Link]($(echo "$IPA_LINK" | tr -d '"')) |
EOM
gh pr comment $FCI_PULL_REQUEST_NUMBER -b "$COMMENT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment