Skip to content

ci: improve handling of pr labels - #8169

Merged
blink1073 merged 9 commits into
scikit-image:mainfrom
blink1073:process-labels-script
May 20, 2026
Merged

blink1073 merged 9 commits into
scikit-image:mainfrom
blink1073:process-labels-script

Conversation

@blink1073

@blink1073 blink1073 commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

Partially addresses #8166, by checking the current state of the PR instead of the triggering event, enabling you to add the label and then re-run CI without pushing another commit.

Adds a central script to .github/scripts to share the logic between workflows.

Run without label: "Run only modified tests"
Run after label (no new push): "Run all tests"

AI Usage

This PR was developed with the assistance of Claude Code (claude-sonnet-4-6).
I (@blink1073) have thoroughly reviewed the changes.

@blink1073

Copy link
Copy Markdown
Contributor Author

I'll let this run, then add the label and kick a linux, windows, and macos job.

@greptile-apps

greptile-apps Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "ci: improve handling of pr labels" | Re-trigger Greptile

Comment thread .github/scripts/check-labels.sh Resolved
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "Update .github/scripts/check-labels.sh" | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (3): Last reviewed commit: "Merge branch 'process-labels-script' of ..." | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (4): Last reviewed commit: "move label check to run per job on linux" | Re-trigger Greptile

@blink1073 blink1073 added the 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR label May 17, 2026
@blink1073 blink1073 removed the 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR label May 17, 2026
@blink1073 blink1073 closed this May 17, 2026
@blink1073 blink1073 reopened this May 17, 2026
@greptile-apps

greptile-apps Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Reviews (5): Last reviewed commit: "fix grep" | Re-trigger Greptile

@blink1073 blink1073 added the 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR label May 17, 2026
Comment thread .github/scripts/check-labels.sh Outdated
exit 0
fi

LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit counterintuitive: do we not already have access to the labels in the workflow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR addresses the problem of the labels being associated with the event. Lars pointed out that he expected to be able to add the label and then re-run the workflow, but the original event did not have the label applied. This updates the logic to fetch it dynamically. I'll add a comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I also made the script name and step names more explicit.

@blink1073
blink1073 requested a review from stefanv May 19, 2026 12:39
@greptile-apps

greptile-apps Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

Reviews (6): Last reviewed commit: "add new script" | Re-trigger Greptile

# re-running the workflow after adding the 'run-all-tests' label picks up
# the new label state correctly.
LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name')
HAS_LABEL=$(echo "$LABELS" | grep -c 'run-all-tests$' || true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use jq here:

HAS_LABEL=$(gh pr view "$PR_NUMBER" --json labels \
  --jq '[.labels[].name] | contains(["run-all-tests"])')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I tested the script locally with and without the label applied to the PR.

@stefanv stefanv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and merge when ready. Suggested using jq, but the grep approach is fine too.

@blink1073 blink1073 removed the 🧪 run-all-tests Run all of the tests, instead of only those in subpackages that have been modified by the PR label May 20, 2026
@greptile-apps

greptile-apps Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Reviews (7): Last reviewed commit: "address review" | Re-trigger Greptile

@blink1073
blink1073 merged commit 7440b22 into scikit-image:main May 20, 2026
26 checks passed
@blink1073
blink1073 deleted the process-labels-script branch May 20, 2026 11:30
@stefanv stefanv added this to the 0.27 milestone May 20, 2026
matthew-brett added a commit to matthew-brett/scikit-image that referenced this pull request May 21, 2026
* origin/main: (254 commits)
  Refactor, document migration utilities (scikit-image#8184)
  ci: improve handling of pr labels (scikit-image#8169)
  Doctest migration in PRs & on all platforms (scikit-image#8141)
  Update SKIP 4 (import hierarchy, backporting, testing) (scikit-image#8097)
  One page per function / class in HTML docs for skimage2 (scikit-image#8154)
  Pin minimum pytest to 9 (scikit-image#8174)
  docs: make source install instructions more discoverable and add build requirements to top level requirements file (scikit-image#8165)
  Drop `--maxfail=5` from local pytest config (scikit-image#8170)
  Use standard C99 static inline instead of `__inline` (scikit-image#8159)
  Fix structural_similarity win_size / gaussian_weights conflict (scikit-image#8162)
  Unwrap seed refactor (scikit-image#8142)
  ci: Remove llvm build and add ccache support on windows (scikit-image#8164)
  Document warn_external in contributing guide (scikit-image#8163)
  CI: Fix emscripten dependencies and clean up wheel test commands (scikit-image#8147)
  Test only changed subpackages (scikit-image#8103)
  Fix nightlies: update deprecated scipy call, fix underdetermined test
  Fix minkowski distanced invocation for SciPy >= 1.18 (scikit-image#8157)
  Port `structural_similarly` to ski2 (scikit-image#8104)
  make spin build requirement a lower bound (scikit-image#8158)
  Drop Python 3.11 Support (scikit-image#8153)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖 type: Infrastructure CI, packaging, tools and automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants