Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows/eval: no maintainer reviews in draft mode #372479

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-nix-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: Check that Nix files are formatted

on:
pull_request_target:
types: [opened, synchronize, reopened, edited]
workflow_call:

permissions: {}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-nixf-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Check changed Nix files with nixf-tidy (experimental)

on:
pull_request_target:
types: [opened, synchronize, reopened, edited]
workflow_call:

permissions: {}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/codeowners-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ name: Codeowners v2

on:
pull_request_target:
types: [opened, ready_for_review, synchronize, reopened, edited]
types: [opened, ready_for_review, synchronize, reopened]
workflow_call:

permissions: {}

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/edited-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Instead of adding all the jobs to run on a changed base to "edited.yml", we use this intermediate layer.
# This will make it, that in the case of editing the title or description, there will only be a single skipped job
# appearing in the checks list, instead of all the jobs below cluttering the output.

name: "Edited Base"

on:
workflow_call:

permissions: {}

jobs:
check-nix-format:
name: Check that Nix files are formatted
uses: ./.github/workflows/check-nix-format.yml

check-nixf-tidy:
name: Check changed Nix files with nixf-tidy (experimental)
uses: ./.github/workflows/check-nixf-tidy.yml

codeowners-v2:
name: Codeowners v2
uses: ./.github/workflows/codeowners-v2.yml

eval:
name: Eval
uses: ./.github/workflows/eval.yml

labels:
name: Label PR
uses: ./.github/workflows/labels.yml
permissions:
contents: read
pull-requests: write

nixpkgs-vet:
name: Vet nixpkgs
uses: ./.github/workflows/nixpkgs-vet.yml

no-channel:
name: No channel PR
if: startsWith(github.event.pull_request.base.ref, 'nixos-') || startsWith(github.event.pull_request.base.ref, 'nixpkgs-')
uses: ./.github/workflows/no-channel.yml
25 changes: 25 additions & 0 deletions .github/workflows/edited.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Some workflows depend on the base branch of the PR, but changing the base branch is not included in the default trigger events, which would be `opened`, `synchronize` or `reopened`.
# Instead it causes an `edited` event.
# Since `edited` is also triggered when PR title/body is changed, we use this wrapper workflow, to run the other workflows conditionally only.
# There is a feature request for adding a `base_changed` event: https://github.com/orgs/community/discussions/35058
#
# Instead of adding this to each workflow's pull_request_target event, we trigger this in a separate workflow.
# This has the advantage, that we can actually skip running those jobs for simple edits like changing the title or description.

name: "Edited"

on:
pull_request_target:
types: [edited]

permissions: {}

jobs:
base:
name: Base
if: github.event.changes.base.ref.from && github.event.changes.base.ref.from != github.event.pull_request.base.ref
uses: ./.github/workflows/edited-base.yml
# Currently needed downstream for labels.yml
permissions:
contents: read
pull-requests: write
4 changes: 4 additions & 0 deletions .github/workflows/eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Eval

on:
pull_request_target:
types: [opened, ready_for_review, synchronize, reopened]
workflow_call:
push:
# Keep this synced with ci/request-reviews/dev-branches.txt
branches:
Expand Down Expand Up @@ -334,3 +336,5 @@ jobs:
REPOSITORY: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
AUTHOR: ${{ github.event.pull_request.user.login }}
# Don't request reviewers on draft PRs
DRY_MODE: ${{ github.event.pull_request.draft && '1' || '' }}
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: "Label PR"

on:
pull_request_target:
types: [edited, opened, synchronize, reopened]
workflow_call:

permissions:
contents: read
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/nixpkgs-vet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ name: Vet nixpkgs

on:
pull_request_target:
# This workflow depends on the base branch of the PR, but changing the base branch is not included in the default trigger events, which would be `opened`, `synchronize` or `reopened`.
# Instead it causes an `edited` event, so we need to add it explicitly here.
# While `edited` is also triggered when the PR title/body is changed, this PR action is fairly quick, and PRs don't get edited **that** often, so it shouldn't be a problem.
# There is a feature request for adding a `base_changed` event: https://github.com/orgs/community/discussions/35058
types: [opened, synchronize, reopened, edited]
workflow_call:

permissions: {}

Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/no-channel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ name: "No channel PR"

on:
pull_request_target:
# Re-run should be triggered when the base branch is updated, instead of silently failing
types: [opened, synchronize, reopened, edited]
branches:
- 'nixos-**'
- 'nixpkgs-**'
workflow_call:

permissions: {}

jobs:
fail:
name: "This PR is is targeting a channel branch"
name: "This PR is targeting a channel branch"
runs-on: ubuntu-24.04
steps:
- run: |
Expand Down