|
5 | 5 | pull_request: |
6 | 6 | branches: ['**'] |
7 | 7 |
|
| 8 | +# Set minimal permissions by default |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
8 | 12 | concurrency: |
9 | 13 | group: ${{ github.workflow }}-${{ github.ref }} |
10 | 14 | cancel-in-progress: ${{ !contains(github.ref, 'main')}} |
|
13 | 17 | install-cache-deps: |
14 | 18 | runs-on: ubuntu-latest |
15 | 19 | name: Install and Cache deps |
| 20 | + permissions: |
| 21 | + contents: read |
16 | 22 | steps: |
17 | 23 | - name: Checkout |
18 | 24 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
|
24 | 30 | needs: [install-cache-deps] |
25 | 31 | runs-on: ubuntu-latest |
26 | 32 | name: Lint |
| 33 | + permissions: |
| 34 | + contents: read |
27 | 35 | steps: |
28 | 36 | - name: Checkout |
29 | 37 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
|
38 | 46 | needs: [install-cache-deps] |
39 | 47 | runs-on: ubuntu-latest |
40 | 48 | name: Typecheck |
| 49 | + permissions: |
| 50 | + contents: read |
41 | 51 | steps: |
42 | 52 | - name: Checkout |
43 | 53 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
|
52 | 62 | needs: [install-cache-deps] |
53 | 63 | runs-on: ubuntu-latest |
54 | 64 | name: Test |
| 65 | + permissions: |
| 66 | + contents: read |
55 | 67 | steps: |
56 | 68 | - name: Checkout |
57 | 69 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
|
62 | 74 | - name: Test |
63 | 75 | run: yarn test:ci:coverage |
64 | 76 |
|
| 77 | + - name: Upload coverage reports |
| 78 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 |
| 79 | + with: |
| 80 | + name: coverage-reports |
| 81 | + path: coverage/ |
| 82 | + retention-days: 1 |
| 83 | + |
| 84 | + # Separate job for codecov upload that only runs on trusted events |
| 85 | + upload-coverage: |
| 86 | + needs: [test] |
| 87 | + runs-on: ubuntu-latest |
| 88 | + name: Upload Coverage |
| 89 | + # Only run on push to main (trusted event) to avoid exposing secrets to forks |
| 90 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 91 | + permissions: |
| 92 | + contents: read |
| 93 | + steps: |
| 94 | + - name: Checkout |
| 95 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 96 | + |
| 97 | + - name: Download coverage reports |
| 98 | + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 |
| 99 | + with: |
| 100 | + name: coverage-reports |
| 101 | + path: coverage/ |
| 102 | + |
65 | 103 | - name: Upload coverage to Codecov |
66 | 104 | uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3 |
67 | 105 | env: |
|
71 | 109 | needs: [install-cache-deps] |
72 | 110 | runs-on: ubuntu-latest |
73 | 111 | name: Test React 18 |
| 112 | + permissions: |
| 113 | + contents: read |
74 | 114 | steps: |
75 | 115 | - name: Checkout |
76 | 116 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
|
0 commit comments