workflows/check: don't check github api for owners file (#446937)

Changed files
+4 -48
.github
ci
github-script
+4 -42
.github/workflows/check.yml
···
mergedSha:
required: true
type: string
-
ownersCanFail:
-
required: true
-
type: boolean
targetSha:
required: true
type: string
secrets:
CACHIX_AUTH_TOKEN:
-
required: true
-
OWNER_RO_APP_PRIVATE_KEY:
required: true
permissions: {}
···
GH_TOKEN: ${{ github.token }}
run: gh api /rate_limit | jq
-
# For checking code owners, this job depends on a GitHub App with the following permissions:
-
# - Permissions:
-
# - Repository > Administration: read-only
-
# - Organization > Members: read-only
-
# - Install App on this repository, setting these variables:
-
# - OWNER_RO_APP_ID (variable)
-
# - OWNER_RO_APP_PRIVATE_KEY (secret)
-
#
-
# This should not use the same app as the job to request reviewers, because this job requires
-
# handling untrusted PR input.
owners:
runs-on: ubuntu-24.04-arm
-
continue-on-error: ${{ inputs.ownersCanFail }}
timeout-minutes: 5
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
···
uses: ./.github/actions/checkout
with:
merged-as-untrusted-at: ${{ inputs.mergedSha }}
-
target-as-trusted-at: ${{ inputs.targetSha }}
- uses: cachix/install-nix-action@9280e7aca88deada44c930f1e2c78e21c3ae3edd # v31
···
pushFilter: -source$
- name: Build codeowners validator
-
run: nix-build nixpkgs/trusted/ci --arg nixpkgs ./nixpkgs/trusted-pinned -A codeownersValidator
-
-
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
-
if: github.event_name == 'pull_request_target' && vars.OWNER_RO_APP_ID
-
id: app-token
-
with:
-
app-id: ${{ vars.OWNER_RO_APP_ID }}
-
private-key: ${{ secrets.OWNER_RO_APP_PRIVATE_KEY }}
-
permission-administration: read
-
permission-members: read
-
-
- name: Log current API rate limits
-
if: steps.app-token.outputs.token
-
env:
-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
-
run: gh api /rate_limit | jq
- name: Validate codeowners
-
if: steps.app-token.outputs.token
env:
OWNERS_FILE: nixpkgs/untrusted/ci/OWNERS
-
GITHUB_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
REPOSITORY_PATH: nixpkgs/untrusted
-
OWNER_CHECKER_REPOSITORY: ${{ github.repository }}
# Set this to "notowned,avoid-shadowing" to check that all files are owned by somebody
EXPERIMENTAL_CHECKS: "avoid-shadowing"
run: result/bin/codeowners-validator
-
-
- name: Log current API rate limits
-
if: steps.app-token.outputs.token
-
env:
-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
-
run: gh api /rate_limit | jq
···
mergedSha:
required: true
type: string
targetSha:
required: true
type: string
secrets:
CACHIX_AUTH_TOKEN:
required: true
permissions: {}
···
GH_TOKEN: ${{ github.token }}
run: gh api /rate_limit | jq
owners:
runs-on: ubuntu-24.04-arm
timeout-minutes: 5
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
···
uses: ./.github/actions/checkout
with:
merged-as-untrusted-at: ${{ inputs.mergedSha }}
- uses: cachix/install-nix-action@9280e7aca88deada44c930f1e2c78e21c3ae3edd # v31
···
pushFilter: -source$
- name: Build codeowners validator
+
run: nix-build nixpkgs/untrusted/ci --arg nixpkgs ./nixpkgs/untrusted-pinned -A codeownersValidator
- name: Validate codeowners
env:
OWNERS_FILE: nixpkgs/untrusted/ci/OWNERS
REPOSITORY_PATH: nixpkgs/untrusted
+
# Omits "owners", which checks whether GitHub handles exist, but fails with nested team
+
# structures.
+
CHECKS: "duppatterns,files,syntax"
# Set this to "notowned,avoid-shadowing" to check that all files are owned by somebody
EXPERIMENTAL_CHECKS: "avoid-shadowing"
run: result/bin/codeowners-validator
-4
.github/workflows/pr.yml
···
OWNER_APP_PRIVATE_KEY:
# The Test workflow should not actually request reviews from owners.
required: false
-
OWNER_RO_APP_PRIVATE_KEY:
-
required: true
concurrency:
group: pr-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
···
pull-requests: write
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
-
OWNER_RO_APP_PRIVATE_KEY: ${{ secrets.OWNER_RO_APP_PRIVATE_KEY }}
with:
baseBranch: ${{ needs.prepare.outputs.baseBranch }}
headBranch: ${{ needs.prepare.outputs.headBranch }}
mergedSha: ${{ needs.prepare.outputs.mergedSha }}
targetSha: ${{ needs.prepare.outputs.targetSha }}
-
ownersCanFail: ${{ !contains(fromJSON(needs.prepare.outputs.touched), 'owners') }}
lint:
name: Lint
···
OWNER_APP_PRIVATE_KEY:
# The Test workflow should not actually request reviews from owners.
required: false
concurrency:
group: pr-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
···
pull-requests: write
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
with:
baseBranch: ${{ needs.prepare.outputs.baseBranch }}
headBranch: ${{ needs.prepare.outputs.headBranch }}
mergedSha: ${{ needs.prepare.outputs.mergedSha }}
targetSha: ${{ needs.prepare.outputs.targetSha }}
lint:
name: Lint
-1
.github/workflows/test.yml
···
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
NIXPKGS_CI_APP_PRIVATE_KEY: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }}
-
OWNER_RO_APP_PRIVATE_KEY: ${{ secrets.OWNER_RO_APP_PRIVATE_KEY }}
push:
if: needs.prepare.outputs.push
···
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
NIXPKGS_CI_APP_PRIVATE_KEY: ${{ secrets.NIXPKGS_CI_APP_PRIVATE_KEY }}
push:
if: needs.prepare.outputs.push
-1
ci/github-script/prepare.js
···
const touched = []
if (files.includes('ci/pinned.json')) touched.push('pinned')
-
if (files.includes('ci/OWNERS')) touched.push('owners')
core.setOutput('touched', touched)
return
···
const touched = []
if (files.includes('ci/pinned.json')) touched.push('pinned')
core.setOutput('touched', touched)
return