Skip to content

Suggested github action change, to prevent clutter in draft PRs#2940

Open
morrowcj wants to merge 8 commits intodevfrom
no-draft-actions
Open

Suggested github action change, to prevent clutter in draft PRs#2940
morrowcj wants to merge 8 commits intodevfrom
no-draft-actions

Conversation

@morrowcj
Copy link
Copy Markdown
Collaborator

@morrowcj morrowcj commented Apr 8, 2026

Prevents the full suite of github actions from running on draft PRs. This will reduce the clutter of PR timelines and notifications by preventing the automated bot actions from occurring on every push before the PR is ready. The new job in "combined_format_lint_test_mypy.yml" runs and fails when the PR is a draft, and the other jobs are skipped, indicating that the PR must be converted to "Ready for review" (which will trigger the other jobs) to proceed.

This change does not affect standard "Ready for review" PRs, which will run the jobs each time a PR undergoes a status change .

What

  • A new job that fails and skips the other jobs on draft PRs
  • run all jobs when the PR is converted to "ready for review"

Why

  • to prevent clutter in PR timelines (and notifications) before they are ready for higher scrutiny

Test plan

  • tested on this PR (see timeline)

Context

The inspiration comes from this thread.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 8, 2026

According to the above time line, this did not work as expected. Although the new job immediately failed, the other jobs proceeded to run anyway. I think this is a syntax error, so I'll try to fix now.

@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 8, 2026

Adding needs: fail_if_pull_request_is_draft to the format_code job causes it (and the subsequent jobs that depend on it) to be skipped.

This was successful, according to the time line and actions log:
image

I will now convert to "Ready for Review" to ensure that the additional jobs are run.

@morrowcj morrowcj marked this pull request as ready for review April 8, 2026 16:58
@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 8, 2026

This didn't work, since the first check was skipped - converting back to a draft to try fixing. I will convert back to "Ready for review" once I think I've fixed it.

@morrowcj morrowcj marked this pull request as draft April 8, 2026 16:59
@morrowcj morrowcj marked this pull request as ready for review April 8, 2026 17:02
@morrowcj morrowcj marked this pull request as draft April 8, 2026 17:03
@morrowcj morrowcj marked this pull request as ready for review April 8, 2026 17:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

so that this action will run when the PR is switched to draft (to allow the first job to fail, rather than skip)
@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 8, 2026

That worked, the draft job skipped, the format job passed, and the type checking job failed:
image

I will now update the changelog, and reconvert to draft then ready for review one more time as a final check.

@morrowcj morrowcj marked this pull request as draft April 8, 2026 17:18
@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 8, 2026

On second thought, I do not believe this PR warrants a changelog entry, since it does not alter the actual code base.
So I'm going to convert to ready, and request review.

@morrowcj morrowcj marked this pull request as ready for review April 8, 2026 17:19
@morrowcj morrowcj requested a review from PooyaHekmati April 8, 2026 17:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

🚨 Please update the changelog. This PR cannot be merged until changelog.md is updated.

@PooyaHekmati
Copy link
Copy Markdown
Collaborator

Thanks @morrowcj for noticing and working on this.
Besides the technicalities, I would like to hear from other team members how do they feel about this. on one hand we have the benefit of reduced notifications; on the other hand, we have the benefit of making sure everything passes on github before marking the PR ready for review. we have had cases in the past that checks passed locally but failed on github.

Side note: all PRs need an entry in changelog. The decision about the importance of each entry is made when we are reading the changelog and consuming its content.

@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 8, 2026

on one hand we have the benefit of reduced notifications; on the other hand, we have the benefit of making sure everything passes on github before marking the PR ready for review. we have had cases in the past that checks passed locally but failed on github.

That makes sense to me, and I agree with the pros and cons you stated. I'm interested to hear what others think!

Side note: all PRs need an entry in changelog. The decision about the importance of each entry is made when we are reading the changelog and consuming its content.

Good to know: done!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@morrowcj
Copy link
Copy Markdown
Collaborator Author

Feedback from a few members of the dev team at yesterday's Work Together session seemed generally positive to this idea. One additional suggestion that came up is possibly including an option to manually trigger the jobs that are skipped on a draft branch. This can likely be accomplished with the workflow_dispatch event.

@morrowcj morrowcj marked this pull request as draft April 10, 2026 17:42
@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 10, 2026

After a quick commit attempting enable this functionality and re-converting to a draft, I have confirmed that the changes were successful. The actions could be manually triggered even though the PR is a draft:

Triggering the run:
image

results of the run:
image

The only downside of this is that the results of a manually triggered run do not show up on the PR timeline.

@morrowcj morrowcj marked this pull request as ready for review April 10, 2026 18:06
@github-actions
Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@morrowcj morrowcj marked this pull request as draft April 10, 2026 18:26
@morrowcj morrowcj marked this pull request as ready for review April 10, 2026 18:30
@github-actions
Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

Copy link
Copy Markdown
Collaborator

@ew3361zh ew3361zh left a comment

Choose a reason for hiding this comment

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

I think this is close for me, I like the direction overall and agree with the premise behind the changes.

I think working on clarity for new (and existing) contributors about what's happening with GH actions on a draft branch would be my preference. And I think if possible that should happen through the GH actions (i.e. they shouldn't fail here but rather not run)

branches: [ dev ]
pull_request:
branches: [ dev ]
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you talk a little about how you put together this particular group of types (and maybe what synchronize is?)?

Copy link
Copy Markdown
Collaborator Author

@morrowcj morrowcj Apr 14, 2026

Choose a reason for hiding this comment

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

Great question: the defaults (if you don't include the "types" key) that trigger an action on PR are opened, synchronize, and reopen. I wanted to also add triggers for converting the PR to and from drafts. Source

I believe synchronize is whenever there is a commit pushed to the HEAD reference of the PR's "from" branch.

Comment on lines +20 to +21
- name: Fails in order to indicate that PR needs to be marked as ready to review and other checks passed.
run: exit 1 # don't run other jobs
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I realize the purpose of this is to declutter the conversation on a PR by not posting unnecessary messages but just wondering if you think it would be confusing for contributors (new/old) to see actions failed with no explanation rather than just not running them at all if it's a draft PR?

I think I'd probably prefer just not running the jobs without explicitly failing.

Copy link
Copy Markdown
Collaborator Author

@morrowcj morrowcj Apr 14, 2026

Choose a reason for hiding this comment

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

I think I agree with you and was originally going to do exactly that (skip checks on draft) but came across a thread where people expressed interest in being alerted or otherwise indicated that the skips occurred in order to remind them that they need to flag it as ready for review. If we don't have that need, I'm happy that remove the failing check!

@morrowcj morrowcj self-assigned this Apr 14, 2026
@morrowcj morrowcj marked this pull request as draft April 14, 2026 18:46
@morrowcj morrowcj marked this pull request as ready for review April 14, 2026 18:48
@github-actions
Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on no-draft-actions branch: 1191
Mypy errors on dev branch: 1191
No difference in error counts

@morrowcj
Copy link
Copy Markdown
Collaborator Author

@ew3361zh, I removed the check that fails on a draft PR. I then converted back to a draft to test and, as you can see, the tests were successfully skipped:

image

and then fully ran when converted back to "ready for review":

image

I also replied to your question about the types above and will re-request your review.

@morrowcj morrowcj requested a review from ew3361zh April 14, 2026 18:57
@morrowcj
Copy link
Copy Markdown
Collaborator Author

morrowcj commented Apr 14, 2026

I also wonder if it is possible to reduce the frequency of redundant comments like these ones:

image

Perhaps by having the bot edit the comment if it already exists instead of creating a new one. It seems that option exists, but probably better suited for a different issue/PR.

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.

3 participants