Require merged pull request before finishing Step 3 - #70
Merged
Conversation
The Step 3 grading job triggers on any push to main under docs/**. When the
personas/roles change reaches main via a direct commit (for example, when the
Copilot Cloud Agent commits straight to main instead of opening a pull request),
the file check passed and the exercise finished before any pull request was
reviewed or merged, closing the exercise issue prematurely.
Add a guard that confirms the pushed change is associated with a merged pull
request via the commits/{sha}/pulls API. Direct commits now fail with actionable
feedback and the exercise no longer completes until the personas/roles pull
request is actually merged.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Step 3 grading workflow to ensure the exercise only completes when the personas/roles documentation update reaches main via a merged pull request, preventing premature completion from direct commits that touch docs/**.
Changes:
- Adds a guard step that queries the
commits/{sha}/pullsAPI and requires at least one associated PR withmerged_atset. - Adds
pull-requests: readpermission to support the new API call. - Surfaces the new guard’s result in the step results table and ensures the job fails if the guard fails.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/3-last-step.yml |
Adds a merged-PR verification gate (via gh api) before allowing Step 3 grading to succeed, preventing finish logic from running on direct commits. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
In Step 3, the exercise issue was closing before any pull request was reviewed or merged. The Step 3 grading workflow triggers on any
pushtomaintouchingdocs/**. When the personas/roles change reachedmainvia a direct commit (for example, when the Copilot Cloud Agent commits straight tomaininstead of opening a pull request), the "personas doc changed" check passed and the exercise finished immediately, closing the exercise issue prematurely.This was reproduced in a learner copy of the repo: the exercise issue closed seconds after the personas issue was created, triggered by a single-parent commit pushed directly to
mainwith no associated PR.Approach
Add a guard step to
.github/workflows/3-last-step.ymlthat confirms the pushed change is associated with a merged pull request before the exercise can complete:commits/{sha}/pullsAPI for the pushed head commit and requires at least one associated PR withmerged_atset.mainreturn no associated PR, so the step fails with actionable feedback and the grading job fails, which preventsfinish_exercisefrom running. The exercise issue stays open until the PR is actually merged.pull-requests: readpermission.Notes
maintrigger (previously chosen to avoid Actions approval prompts) and only gates completion on a real merge.