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

Document auto-closing keywords for PRs. #855

Merged
merged 6 commits into from
Oct 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions getting-started/git-boot-camp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,28 @@ Creating a Pull Request

6. Press the ``Create pull request`` button.

You should include the issue number in the title of the PR,
in the format ``gh-NNNNN: <PR Title>``.

Linking to Issues and Pull Requests
-----------------------------------

You can link to issues and pull requests using ``gh-NNNNN`` (this form is
preferred over ``#NNNNN``). If the reference appears in a list, the link
ezio-melotti marked this conversation as resolved.
Show resolved Hide resolved
will be expanded to show the status and title of the issue/PR.
Copy link
Member

@CAM-Gerlach CAM-Gerlach Aug 18, 2022

Choose a reason for hiding this comment

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

Oh, is that really what triggers this? I've gotten inconsistent results in my resent testing, with links sometimes expanding and sometimes not in and outside of lists, even in the same spot. I'd be very curious to know.

Also, gh (and #?) references in commit messages get expanded to pythongh—how does that happen?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, is that really what triggers this?

I think so, and it took me a while to figure that out too. ISTM that references like #855 are consistently expanded in lists like:

  1. Document auto-closing keywords for PRs. #855
  2. with some text Document auto-closing keywords for PRs. #855

But not in paragraphs like this (#855) or quotes like

#855

Do you have any counterexamples?

Also, gh (and #?) references in commit messages get expanded to pythongh—how does that happen?

I've seen that and I think it's just a bug in GitHub.

Copy link
Member

Choose a reason for hiding this comment

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

with some text #855

Ah, I misinterpreted what you said originally to mean just bullets with no other text, when I was seeing them both with and without—silly me.

Do you have any counterexamples?

Not any others that I can reliably reproduce—I believe the behavior I saw (on the What's New issues) when I was trying to figure this out might have perhaps just been a combination of an issue where the link wasn't getting created as above when the linked issue hadn't been created when I loaded the page, and/or just not being totally sure what caused it when testing a number of things (particularly #NNN vs org/repo#NNN vs <full URL> vs. ).

Copy link
Member

Choose a reason for hiding this comment

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

One side note that came up during some related testing—AFAIK, GH-/gh- doesn't trigger the issue number lookup and autocompletion, which I find invaluable especially on repos nearing 6 digit issue and PR numbers like CPython.

Copy link
Member Author

Choose a reason for hiding this comment

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

In #946 (review) the ref is not expanded, maybe because it's in a review?

Screenshot showing both the unexpanded list, and the popup on the first ref which confirms the ref is correct:
image


When you create a PR that includes ``gh-NNNNN`` in the title, `bedevere`_
will automatically add a link to the issue in the first message.

In addition, pull requests support `special keywords`_ that can be used to
link to an issue and automatically close it when the PR is merged.
However, issues often require multiple PRs before they can be closed (e.g.
backports to other branches), so this features is only useful if
you know for sure that a single PR is enough to address and close the issue.

.. _bedevere: https://github.com/python/bedevere
.. _special keywords: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

Updating your CPython Fork
--------------------------

Expand Down