Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(CI): Zulip :closed-pr: emoji reaction #20902

Closed
wants to merge 5 commits into from

Conversation

adomani
Copy link
Collaborator

@adomani adomani commented Jan 21, 2025

Add a workflow that is triggered by closing a PR. If the PR does title not start with [Merged by Bors], then the script adds the :closed-pr: emoji reaction to messages on Zulip that link to the PR number.


Open in Gitpod

Copy link

github-actions bot commented Jan 21, 2025

PR summary b44c5dbddb

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the CI Modifies the continuous integration / deployment setup label Jan 21, 2025
@adomani adomani added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jan 21, 2025
Copy link
Collaborator

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Looks plausible at first side. The python changes LGTM (assuming one of them is just a type). I'd need to look at the workflow more closely and compare it to the others.

scripts/zulip_emoji_merge_delegate.py Outdated Show resolved Hide resolved
@adomani adomani changed the title feat(CI): Zulip closed-pr emoji reaction feat(CI): Zulip :closed-pr: emoji reaction Jan 21, 2025
Copy link
Collaborator

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

I took a look. Looks good in general; I think this can land soon.
I suspect there may be one or two bugs, but these should be easy to fix. (Did you test this locally? Or is the only way to test this to run it in production?)

Finally, I wonder if this does what we want.
Currently, this workflow only runs on closed PRs that were merged by bors. This means

  • it won't apply to PRs which are closed (because the PR is superseded, or not suitable for mathlib, or some other reasons) but unmerged
  • it does not run on merged PRs (these also exist, e.g. mathlib adaptation PRs, or somebody updating their personal fork). I think those PRs could also be nice to handle...

What do you think?
In any case: can you please document the intended behaviour in the workflow, say with a comment on top? Having merged PRs be "closed", not "merged", is a mathlib peculiarity: this might not be obvious for the readers of this file.

ZULIP_EMAIL: [email protected]
ZULIP_SITE: https://leanprover.zulipchat.com
run: |
python scripts/zulip_emoji_merge_delegate.py "$ZULIP_API_KEY" "$ZULIP_EMAIL" "$ZULIP_SITE" "closed" "${{ github.event.issue.number }}${{ github.event.pull_request.number }}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be the following?

Suggested change
python scripts/zulip_emoji_merge_delegate.py "$ZULIP_API_KEY" "$ZULIP_EMAIL" "$ZULIP_SITE" "closed" "${{ github.event.issue.number }}${{ github.event.pull_request.number }}"
python scripts/zulip_emoji_merge_delegate.py "$ZULIP_API_KEY" "$ZULIP_EMAIL" "$ZULIP_SITE" "closed" "${{ github.event.issue.number }}" "${{ github.event.pull_request.number }}"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that this is correct as is: at most one is defined, probably github.event.pull_request.number, but I won't know for sure until this gets tested and the previous CI step tells me what the numbers are! 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

Fine. Can you either add a comment or follow up with a PR deleting the wrong one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was planning to follow up with PRs fixing this mistake (and the other ones that are likely present! 😄 )

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure, works for me :-)

.github/workflows/zulip_emoji_closed_pr.yaml Show resolved Hide resolved
.github/workflows/zulip_emoji_closed_pr.yaml Show resolved Hide resolved
@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes label Jan 21, 2025
@adomani
Copy link
Collaborator Author

adomani commented Jan 21, 2025

Testing locally is hard, since GitHub will run this script only once it is in master. The idea is that we try our best, test it as soon as it enters mathlib and then fix the issues quickly! Since closing un-merged PRs is not common and the consequence of the script malfunctioning are adding a weird zulip reaction, there is not much at stake!

@adomani
Copy link
Collaborator Author

adomani commented Jan 21, 2025

I took a look. Looks good in general; I think this can land soon. I suspect there may be one
Finally, I wonder if this does what we want. Currently, this workflow only runs on closed PRs that were merged by bors. This means

Why do you say that? I think that this will run on all closed PRs, regardless of who closed them. The ones that get closed by bors will have been renamed to [Merged by Bors] and a step of the script checks whether this is the case and ignores PRs that are closed and have title starting with [Merged by Bors].

The remaining PRs will likely

  • have been closed by a human,
  • have not been merged,
  • receive a reaction on Zulip!

@adomani adomani removed the awaiting-author A reviewer has asked the author a question or requested changes label Jan 21, 2025
@bryangingechen bryangingechen self-assigned this Jan 21, 2025
@grunweg
Copy link
Collaborator

grunweg commented Jan 21, 2025

Indeed, I was tired and overlooked the negation 🤦‍♂️ Right, so this labels all closed PRs that have not been labelled by bors. This makes sense.

@grunweg
Copy link
Collaborator

grunweg commented Jan 21, 2025

The new changes look good. I'm still not sure about the cone option, but we can totally YOLO-deploy it and merge this PR. We need to test it live anyway.
maintainer merge

Copy link

🚀 Pull request has been placed on the maintainer queue by grunweg.

Copy link

🚀 Pull request has been placed on the maintainer queue by grunweg.

@jcommelin
Copy link
Member

Thanks 🎉

bors merge

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the ready-to-merge This PR has been sent to bors. label Jan 21, 2025
mathlib-bors bot pushed a commit that referenced this pull request Jan 21, 2025
Add a workflow that is triggered by closing a PR.  If the PR does title not start with `[Merged by Bors]`, then the script adds the `:closed-pr:` emoji reaction to messages on Zulip that link to the PR number.
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 21, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title feat(CI): Zulip :closed-pr: emoji reaction [Merged by Bors] - feat(CI): Zulip :closed-pr: emoji reaction Jan 21, 2025
@mathlib-bors mathlib-bors bot closed this Jan 21, 2025
@mathlib-bors mathlib-bors bot deleted the adomani/zulip_reaction_closed_pr branch January 21, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Modifies the continuous integration / deployment setup maintainer-merge ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants