|
9 | 9 | headBranch: |
10 | 10 | required: true |
11 | 11 | type: string |
| 12 | + mergedSha: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + targetSha: |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + secrets: |
| 19 | + CACHIX_AUTH_TOKEN: |
| 20 | + required: true |
| 21 | + OWNER_RO_APP_PRIVATE_KEY: |
| 22 | + required: true |
12 | 23 |
|
13 | 24 | permissions: {} |
14 | 25 |
|
|
70 | 81 | env: |
71 | 82 | GH_TOKEN: ${{ github.token }} |
72 | 83 | run: gh api /rate_limit | jq |
| 84 | + |
| 85 | + # For checking code owners, this job depends on a GitHub App with the following permissions: |
| 86 | + # - Permissions: |
| 87 | + # - Repository > Administration: read-only |
| 88 | + # - Organization > Members: read-only |
| 89 | + # - Install App on this repository, setting these variables: |
| 90 | + # - OWNER_RO_APP_ID (variable) |
| 91 | + # - OWNER_RO_APP_PRIVATE_KEY (secret) |
| 92 | + # |
| 93 | + # This should not use the same app as the job to request reviewers, because this job requires |
| 94 | + # handling untrusted PR input. |
| 95 | + owners: |
| 96 | + runs-on: ubuntu-24.04-arm |
| 97 | + timeout-minutes: 5 |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 100 | + with: |
| 101 | + sparse-checkout: .github/actions |
| 102 | + - name: Check if the PR can be merged and checkout the merge and target commits |
| 103 | + uses: ./.github/actions/get-merge-commit |
| 104 | + with: |
| 105 | + mergedSha: ${{ inputs.mergedSha }} |
| 106 | + merged-as-untrusted: true |
| 107 | + pinnedFrom: trusted |
| 108 | + targetSha: ${{ inputs.targetSha }} |
| 109 | + target-as-trusted: true |
| 110 | + |
| 111 | + - uses: cachix/install-nix-action@fc6e360bedc9ee72d75e701397f0bb30dce77568 # v31 |
| 112 | + |
| 113 | + - uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 |
| 114 | + with: |
| 115 | + # This cache is for the nixpkgs repo checks and should not be trusted or used elsewhere. |
| 116 | + name: nixpkgs-ci |
| 117 | + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' |
| 118 | + |
| 119 | + - name: Build codeowners validator |
| 120 | + run: nix-build trusted/ci --arg nixpkgs ./pinned -A codeownersValidator |
| 121 | + |
| 122 | + - uses: actions/create-github-app-token@0f859bf9e69e887678d5bbfbee594437cb440ffe # v2.1.0 |
| 123 | + if: github.event_name == 'pull_request_target' && vars.OWNER_RO_APP_ID |
| 124 | + id: app-token |
| 125 | + with: |
| 126 | + app-id: ${{ vars.OWNER_RO_APP_ID }} |
| 127 | + private-key: ${{ secrets.OWNER_RO_APP_PRIVATE_KEY }} |
| 128 | + permission-administration: read |
| 129 | + permission-members: read |
| 130 | + |
| 131 | + - name: Log current API rate limits |
| 132 | + if: steps.app-token.outputs.token |
| 133 | + env: |
| 134 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 135 | + run: gh api /rate_limit | jq |
| 136 | + |
| 137 | + - name: Validate codeowners |
| 138 | + if: steps.app-token.outputs.token |
| 139 | + env: |
| 140 | + OWNERS_FILE: untrusted/ci/OWNERS |
| 141 | + GITHUB_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }} |
| 142 | + REPOSITORY_PATH: untrusted |
| 143 | + OWNER_CHECKER_REPOSITORY: ${{ github.repository }} |
| 144 | + # Set this to "notowned,avoid-shadowing" to check that all files are owned by somebody |
| 145 | + EXPERIMENTAL_CHECKS: "avoid-shadowing" |
| 146 | + run: result/bin/codeowners-validator |
| 147 | + |
| 148 | + - name: Log current API rate limits |
| 149 | + if: steps.app-token.outputs.token |
| 150 | + env: |
| 151 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 152 | + run: gh api /rate_limit | jq |
0 commit comments