fix: dynamic tab sync #385
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Expo Preview | |
on: | |
pull_request: | |
types: [labeled, opened, reopened, synchronize] | |
jobs: | |
publish: | |
name: Install and publish | |
if: contains(github.event.pull_request.labels.*.name, 'preview') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- uses: expo/expo-github-action@v5 | |
with: | |
expo-version: 4.x | |
expo-token: ${{ secrets.EXPO_TOKEN }} | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: ./example | |
- name: Publish Expo app | |
run: expo publish --release-channel=pr-${{ github.event.number }} | |
working-directory: ./example | |
env: | |
EXPO_USE_DEV_SERVER: true | |
- name: Get expo link | |
id: expo | |
run: echo "::set-output name=path::@pedrobern/react-native-collapsible-tab-view-demos?release-channel=pr-${{ github.event.number }}" | |
- name: Comment on PR | |
uses: actions/github-script@v2 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const body = 'The Expo app for the example from this branch is ready!\n\n[expo.io/${{ steps.expo.outputs.path }}](https://expo.io/${{ steps.expo.outputs.path }})\n\n<a href="https://expo.io/${{ steps.expo.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo.outputs.path }}" height="200px" width="200px"></a>'; | |
const comments = await github.issues.listComments({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
if (comments.data.some(comment => comment.body === body)) { | |
return; | |
} | |
github.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body | |
}) |