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