Skip to content

chore: update preview qr code #2698

chore: update preview qr code

chore: update preview qr code #2698

name: Expo Preview
on: [pull_request]
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.full_name == 'callstack/react-native-paper'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Setup Expo
uses: expo/expo-github-action@v7
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Restore dependencies
id: yarn-cache
uses: actions/cache/restore@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
sudo corepack enable
yarn --cwd example --immutable
yarn --immutable
- name: Cache dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: '**/node_modules'
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
- name: Publish Expo app
working-directory: ./example
run: CI=1 rm -rf android && eas update --branch=pr-${{ github.event.number }} --message="$(git log -1 --pretty=%B)"
- name: Get expo config
working-directory: ./example
id: expo
run: echo "EXPO_CONFIG=$(npx expo config --json)" >> $GITHUB_OUTPUT
- name: Comment on PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |

Check failure on line 61 in .github/workflows/publish-each-pr.yml

View workflow run for this annotation

GitHub Actions / Expo Preview

Invalid workflow file

The workflow is not valid. .github/workflows/publish-each-pr.yml (Line: 61, Col: 19): Unrecognized named-value: 'channel'. Located at position 1 within expression: channel
const channel = 'pr-${{ github.event.number }}';
const config = JSON.parse('${{ steps.expo.outputs.EXPO_CONFIG }}');
const branch = JSON.parse('$(eas branch:view ${{channel}} --json --non-interactive )')
const { sdkVersion } = config;
const { projectId } = config.extra.eas;
const { id } = branch;
const url = `https://expo.dev/@react-native-paper/react-native-paper-example?serviceType=eas&distribution=expo-go&scheme=exp+react-native-paper-example&channel=${channel}&sdkVersion=${sdkVersion}`;
const body = `The mobile version of example app from this branch is ready! You can [see it here.](${url})
<a href="${url}"><img src="https://qr.expo.dev/eas-update?projectId=${projectId}&runtimeVersion=exposdk:${sdkVersion}&branchId=${id}" height="200px" width="200px"></a>
`;
const comments = await github.rest.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.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
})