xref: /expo/.github/workflows/sdk.yml (revision f2fbea2e)
1name: SDK
2
3on:
4  workflow_dispatch:
5    inputs:
6      checkAll:
7        description: 'type "check-all" to force checking all packages'
8        required: false
9        default: ''
10  push:
11    branches: [main, 'sdk-*']
12    paths:
13      - .github/workflows/sdk.yml
14      - tools/**
15      - packages/**
16      - yarn.lock
17      # Ignore Expo CLI for now...
18      - '!packages/@expo/cli/**'
19  pull_request:
20    paths:
21      - .github/workflows/sdk.yml
22      - tools/**
23      - packages/**
24      - yarn.lock
25      # Ignore Expo CLI for now...
26      - '!packages/@expo/cli/**'
27  schedule:
28    - cron: 0 14 * * *
29
30concurrency:
31  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
32  cancel-in-progress: true
33
34jobs:
35  check-packages:
36    runs-on: ubuntu-20.04
37    steps:
38      - name: �� Checkout
39        uses: actions/checkout@v3
40        with:
41          fetch-depth: 100
42      - name: ⬇️ Fetch commits from base branch
43        run: git fetch origin ${{ github.event.before || github.base_ref || 'main' }}:${{ github.event.before || github.base_ref || 'main' }} --depth 100
44        if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
45      - name: ♻️ Restore caches
46        uses: ./.github/actions/expo-caches
47        id: expo-caches
48        with:
49          yarn-workspace: 'true'
50          yarn-tools: 'true'
51      - name: �� Install workspace node modules
52        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
53        run: yarn install --frozen-lockfile
54      - name: �� Check packages
55        run: |
56          echo "Checking packages according to the event name: ${{ github.event_name }}"
57          if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event.inputs.checkAll }}" == "check-all" ]]; then
58            # Check all packages on scheduled events or if requested by workflow_dispatch event.
59            bin/expotools check-packages --all
60          else
61            # On push event check packages changed since previous remote head.
62            # In pull requests and workflow_dispatch events check all packages changed in the entire PR.
63            bin/expotools check-packages --since ${{ github.event.before || github.base_ref || 'main' }}
64          fi
65      - name: �� Notify on Slack
66        uses: 8398a7/action-slack@v3
67        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
68        env:
69          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_api }}
71        with:
72          channel: '#expo-sdk'
73          status: ${{ job.status }}
74          fields: job,message,ref,eventName,author,took
75          author_name: Check packages
76