Skip to content

Conversation

@johnduffell
Copy link
Member

@johnduffell johnduffell commented Dec 12, 2025

after the outcome of discussions relating to guardian/support-service-lambdas#3280
on this thread https://chat.google.com/room/AAAAag0I08g/XFliRTXYAzQ/XFliRTXYAzQ?cls=10

This PR makes the workflow only run on PRs that are not draft

Tested using this PR guardian/support-service-lambdas#3280 :
image

and when it's marked ready for review
image

The only issue is you need to add "ready_for_review" as a trigger as seen in the above PR
https://github.com/guardian/support-service-lambdas/pull/3280/files#diff-121fb0d715d38abf3163eb63b4ce94e1a9e6fa685f89d8b61d9b8eb5e31cbb81R6

@johnduffell johnduffell requested a review from a team as a code owner December 12, 2025 08:55
@johnduffell johnduffell added the feature Departmental tracking: work on a new feature label Dec 12, 2025
@johnduffell johnduffell requested a review from Copilot December 12, 2025 08:58
Copy link

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 PR modifies the GitHub Actions workflow to only enforce the required label check on pull requests that target the default branch, avoiding unnecessary checks on PRs targeting other branches (e.g., feature branches).

Key Changes:

  • Added a conditional check to the workflow job to filter PRs by their target branch

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


jobs:
require-label:
if: github.event.pull_request.base.ref == github.event.repository.default_branch
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The comparison will always fail because github.event.repository.default_branch returns the branch name as a string (e.g., 'main'), but github.event.pull_request.base.ref also returns a string. However, the correct way to reference the default branch name is github.event.repository.default_branch without any further qualification. The condition should compare the base ref name directly: github.event.pull_request.base.ref == github.event.repository.default_branch.\n\nActually, upon closer inspection, this syntax is correct for the comparison. However, ensure this works as intended by testing, as the typical pattern seen is to use string literals or to be explicit about what's being compared.

Suggested change
if: github.event.pull_request.base.ref == github.event.repository.default_branch
if: github.ref_name == github.event.repository.default_branch

Copilot uses AI. Check for mistakes.
@johnduffell johnduffell changed the title only run core4 check on PRs to the default branch only run core4 check on non-draft PRs Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants