Skip to content

Add check of invalid label in rescue#244

Merged
whywaita merged 2 commits intomasterfrom
fix/ignore-rescue-job-in-already-created
Jul 29, 2025
Merged

Add check of invalid label in rescue#244
whywaita merged 2 commits intomasterfrom
fix/ignore-rescue-job-in-already-created

Conversation

@whywaita
Copy link
Copy Markdown
Owner

fixes: #228

Summary (generated)

This pull request refactors label-checking logic to improve code reusability and maintainability. The key changes include introducing a new utility function IsRequestedMyshoesLabel in the pkg/gh/label.go file and replacing duplicate label-checking logic with calls to this function across the codebase.

Refactoring and code reuse:

  • Added the IsRequestedMyshoesLabel function in pkg/gh/label.go to encapsulate the logic for checking if a job has appropriate labels (myshoes, self-hosted, or dependabot).
  • Replaced the inline label-checking logic in pkg/web/webhook.go with a call to the new gh.IsRequestedMyshoesLabel function, removing the redundant isRequestedMyshoesLabel function. [1] [2]

Functional changes:

  • Updated the enqueueRescueRun function in pkg/starter/starter.go to skip rescue jobs without the required labels by using the new gh.IsRequestedMyshoesLabel function. This adds logging for skipped jobs.

Minor adjustments:

  • Removed unused githubURL variable in pkg/starter/scripts.go and adjusted related code for label handling. [1] [2]

@whywaita whywaita requested a review from Copilot July 24, 2025 16:49
@whywaita whywaita self-assigned this Jul 24, 2025

This comment was marked as outdated.

@whywaita whywaita requested a review from Copilot July 24, 2025 17:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors label-checking logic to improve code reusability and adds validation to prevent rescuing jobs not generated by myshoes. The changes extract duplicate label validation logic into a centralized utility function and ensure the system always adds the "dependabot" label for compatibility.

  • Extracts duplicate label-checking logic into a reusable IsRequestedMyshoesLabel function
  • Adds label validation to the rescue job process to skip jobs without appropriate myshoes labels
  • Updates runner setup to always include the "dependabot" label regardless of GitHub URL configuration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
pkg/gh/label.go New utility function for checking if jobs have appropriate myshoes labels
pkg/web/webhook.go Replaces local label checking with the new centralized function
pkg/starter/starter.go Adds label validation to rescue job processing with logging
pkg/starter/scripts.go Simplifies label assignment to always include "dependabot" label

@whywaita whywaita merged commit ab96f80 into master Jul 29, 2025
5 checks passed
@whywaita whywaita deleted the fix/ignore-rescue-job-in-already-created branch July 29, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Must ignore rescue job that not include myshoes labels in runs-on

2 participants