name: SDK on: workflow_dispatch: inputs: checkAll: description: 'type "check-all" to force checking all packages' required: false default: '' push: branches: [master, 'sdk-*'] paths: - .github/workflows/sdk.yml - tools/** - packages/** - yarn.lock pull_request: branches: [master] paths: - .github/workflows/sdk.yml - tools/** - packages/** - yarn.lock schedule: - cron: 0 14 * * * jobs: check-packages: runs-on: ubuntu-18.04 steps: - name: ๐Ÿ‘€ Checkout a ref for the event uses: actions/checkout@v2 with: fetch-depth: 100 - name: โฌ‡๏ธ Fetch commits from base branch run: git fetch origin ${{ github.event.before || github.base_ref || 'master' }}:${{ github.event.before || github.base_ref || 'master' }} --depth 100 if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' - name: โ™ป๏ธ Restore workspace node modules uses: actions/cache@v2 id: node-modules-cache with: path: | # See "workspaces" โ†’ "packages" in the root package.json for the source of truth of # which node_modules are affected by the root yarn.lock node_modules apps/*/node_modules home/node_modules packages/*/node_modules packages/@unimodules/*/node_modules react-native-lab/react-native/node_modules key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} - name: ๐Ÿงถ Install node modules in root dir # if: steps.node-modules-cache.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile - name: โ™ป๏ธ Restore node modules in tools uses: actions/cache@v2 with: path: tools/node_modules key: ${{ runner.os }}-modules-${{ hashFiles('tools/yarn.lock') }} - name: ๐Ÿง Check packages run: | echo "Checking packages according to the event name: ${{ github.event_name }}" if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event.inputs.checkAll }}" == "check-all" ]]; then # Check all packages on scheduled events or if requested by workflow_dispatch event. bin/expotools check-packages --all else # On push event check packages changed since previous remote head. # In pull requests and workflow_dispatch events check all packages changed in the entire PR. bin/expotools check-packages --since ${{ github.event.before || github.base_ref || 'master' }} fi - name: ๐Ÿ”” Notify on Slack uses: 8398a7/action-slack@v3 if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-')) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_api }} with: channel: '#api' status: ${{ job.status }} fields: job,commit,ref,eventName,author,took author_name: Check packages