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

Show the earliest tag after a merged PR #3088

Closed
fregante opened this issue May 13, 2020 · 3 comments · Fixed by #3093
Closed

Show the earliest tag after a merged PR #3088

fregante opened this issue May 13, 2020 · 3 comments · Fixed by #3093

Comments

@fregante
Copy link
Member

  1. Visit a merged PR, like Add isRepoMainSettings github-url-detection#2
  2. Has this PR been published/tagged yet?

Currently, the fastest way to do this:

  1. Open the More menu
  2. Visit Commits
  3. Look for the current PR in the list and figure it out

If you open the commit itself, GitHub will show both the branch and the tag that commit appears in, for example: refined-github/github-url-detection@329d756

We could show a similar information on the PR event list:

@yakov116
Copy link
Member

yakov116 commented May 13, 2020

If someone wants to send A PR, I figured out how github gets the info

Get the merge commit from the DOM to get the associated tag
example URL https://github.com/fregante/github-url-detection/branch_commits/329d756 <-- merge commit abbreviatedOid

const getAssociatedTag = async (mergeCommit: string): Promise<string | undefined> => {
	const firstAssociatedTag = await fetchDom(`/${getRepoURL()}/branch_commits/${mergeCommit}`, 'ul.branches-tag-list li:last-child a');
	if (!firstAssociatedTag) {
		return;
	}

	return firstAssociatedTag.textContent!;
};

To get the time it was tagged

const getTagDate = async (lastTag: string): Promise<Date> => {
	const {repository} = await api.v4(`
		repository(${getRepoGQL()}) {
			ref(qualifiedName: "refs/tags/${lastTag}") {
				target {
					... on Tag {
						tagger {
							date
						}
					}
				}
			}
		}
	`);
	return repository.ref.target.tagger.date;
};

@yakov116
Copy link
Member

yakov116 commented May 13, 2020

@fregante I think here.
image

Since sometimes it can be really long PR and many time line items and it would get lost.

@fregante
Copy link
Member Author

fregante commented May 13, 2020

I think here.
image

Yeah that would also avoid the API call.

The code looks simple, you can send a PR. However the PR header is dynamic. Can try using #3084 like here?

https://github.com/sindresorhus/refined-github/blob/ed1708daa89189937ad8411e6ecc5de719ce55b1/source/features/linkify-code.tsx#L22-L26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants