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

fix: tagging author after adding changelog label #243

Closed
wants to merge 18 commits into from

Conversation

nlok5923
Copy link
Contributor

@nlok5923 nlok5923 commented Apr 1, 2021

Fixes: #240

Explanation

Fixes tagging author after adding changelog label.

Checklist

  • I have successfully deployed my own instance of Oppiabot.
    • You can find instructions for doing this here.
  • I have manually tested all the changes made in this PR following the manual tests matrix.

@jameesjohn jameesjohn self-requested a review April 4, 2021 11:17
Copy link
Contributor

@jameesjohn jameesjohn left a comment

Choose a reason for hiding this comment

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

Thanks, @nlok5923.
I'm not sure how this fixes the issue. Can you explain?

@@ -193,12 +193,13 @@ module.exports.checkChangelogLabel = async function (context) {
);

const userName = pullRequest.user.login;
const changelogLabel = getChangelogLabelFromPullRequest(pullRequest);
const changelogLabel = await getChangelogLabelFromPullRequest(pullRequest);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is await added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir previously without await getChangelogLabelFromPullRequest(pullRequest); returns undefined to changeloglabel because of which Boolean(changelogLabel); return false to hasChangelogLabel so to maintain the synchronous execution i used await.

Copy link
Contributor

Choose a reason for hiding this comment

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

But getChangelogLabelFromPullRequest does not return a promise. So await doesn't do anything there.

// If the PR has a changelog label, no action is required.
if (hasChangelogLabel) {
const changelogLabelIsValid = matchChangelogLabelWithRegex(changelogLabel);
const changelogLabelIsValid = await matchChangelogLabelWithRegex(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is await added here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just for testing purpose i added await here removing it .

@oppiabot
Copy link

oppiabot bot commented Apr 9, 2021

Hi @nlok5923. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

@nlok5923
Copy link
Contributor Author

nlok5923 commented Apr 11, 2021

manual testing video: just for testing purpose i am listening to pull request reopen event

tagging.mp4

@oppiabot
Copy link

oppiabot bot commented Apr 11, 2021

Hi @nlok5923. Due to recent changes in the "develop" branch, this PR now has a merge conflict. Please follow this link if you need help resolving the conflict, so that the PR can be merged. Thanks!

@nlok5923
Copy link
Contributor Author

@jameesjohn @vojtechjelinek the functionality is working as expected.

@nlok5923
Copy link
Contributor Author

@jameesjohn sir PTAL i had reverted the unwanted changes sir the getChangelogLabelFromPullRequest in utils do not had any return when pr label do not has PR CHANGELOG prefix that's why it's halting the getChangelogLabelFromPullRequest while testing for currently this pr introduces return statement to getChangelogLabelFromPullRequest in utils when pr do not have label with prefix PR CHANGELOG.

Copy link
Member

@vojtechjelinek vojtechjelinek left a comment

Choose a reason for hiding this comment

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

Thanks! Left a few comments.

const userName = pullRequest.user.login;
const changelogLabel = getChangelogLabelFromPullRequest(pullRequest);
const hasChangelogLabel = Boolean(changelogLabel);

Copy link
Member

Choose a reason for hiding this comment

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

unneeded change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@@ -191,14 +191,14 @@ module.exports.checkChangelogLabel = async function (context) {
'RUNNING CHANGELOG LABEL CHECK ON PULL REQUEST ' +
pullRequestNumber
);

Copy link
Member

Choose a reason for hiding this comment

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

unneeded change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

lib/utils.js Outdated
@@ -270,6 +270,8 @@ const getChangelogLabelFromPullRequest = (pullRequest) => {
);
if (label) {
return label.name.trim();
} else {
return false;
Copy link
Member

Choose a reason for hiding this comment

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

false doesn't make sense here, maybe null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed in latest commit.

Copy link
Member

@vojtechjelinek vojtechjelinek left a comment

Choose a reason for hiding this comment

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

LGTM!

@vojtechjelinek
Copy link
Member

@nlok5923 Frontend tests need to be fixed.

@nlok5923
Copy link
Contributor Author

@vojtechjelinek i had fixed the frontend test.

@nlok5923 nlok5923 assigned jameesjohn and unassigned nlok5923 Apr 30, 2021
Copy link
Contributor

@jameesjohn jameesjohn left a comment

Choose a reason for hiding this comment

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

I'm not sure I understand how this fixes the issue.
Can you show a video of the working before this change, and another after this change?

@jameesjohn jameesjohn assigned nlok5923 and unassigned jameesjohn May 3, 2021
@nlok5923
Copy link
Contributor Author

nlok5923 commented May 4, 2021

sure @jameesjohn

@nlok5923
Copy link
Contributor Author

nlok5923 commented May 8, 2021

I'm not sure I understand how this fixes the issue.
Can you show a video of the working before this change, and another after this change?

yeah @jameesjohn this solution is partial actual solution need to listen to pull_request.labelled event to keep a check on whether change lock label added or not.

I had a doubt that when pull request opened it triggers the pull request open event which follow up with changelog label check but what we need to do is keep data updated so will it work listening to pull request label event just after listening to pull request opened event updating check variable and then oppiabot will comment accordingly.

@nlok5923 nlok5923 requested a review from jameesjohn May 9, 2021 16:52
@nlok5923
Copy link
Contributor Author

This issue is quite rare actually so it's really hard to reproduce it. this issue may only happens if contributor open a pull request at the same time oppiabot should be down to introduce some delay in response and in between response contributor may trigger other event.

but as of now oppiabot is working fine with no downfalls so if contributor opens up a pr he will immediately get a response and he will be having no time to trigger any other event in between so this issue won't occur.

i think we should close this issue what your views @jameesjohn @vojtechjelinek .

@jameesjohn
Copy link
Contributor

I think that's fine. What do you think @vojtechjelinek?

@vojtechjelinek
Copy link
Member

I'm fine with closing this.

@nlok5923
Copy link
Contributor Author

closing this pr as the issue it's addressed is very rare.

@nlok5923 nlok5923 closed this May 18, 2021
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.

Oppiabot is tagging the author again even after the changelog level was added.
3 participants