-
Notifications
You must be signed in to change notification settings - Fork 67
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
Conversation
There was a problem hiding this 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?
lib/checkPullRequestLabels.js
Outdated
@@ -193,12 +193,13 @@ module.exports.checkChangelogLabel = async function (context) { | |||
); | |||
|
|||
const userName = pullRequest.user.login; | |||
const changelogLabel = getChangelogLabelFromPullRequest(pullRequest); | |||
const changelogLabel = await getChangelogLabelFromPullRequest(pullRequest); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
lib/checkPullRequestLabels.js
Outdated
// If the PR has a changelog label, no action is required. | ||
if (hasChangelogLabel) { | ||
const changelogLabelIsValid = matchChangelogLabelWithRegex(changelogLabel); | ||
const changelogLabelIsValid = await matchChangelogLabelWithRegex( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 .
manual testing video: just for testing purpose i am listening to pull request reopen event tagging.mp4 |
Revert "Revert "up""
@jameesjohn @vojtechjelinek the functionality is working as expected. |
@jameesjohn sir PTAL i had reverted the unwanted changes sir the |
There was a problem hiding this 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.
lib/checkPullRequestLabels.js
Outdated
const userName = pullRequest.user.login; | ||
const changelogLabel = getChangelogLabelFromPullRequest(pullRequest); | ||
const hasChangelogLabel = Boolean(changelogLabel); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
lib/checkPullRequestLabels.js
Outdated
@@ -191,14 +191,14 @@ module.exports.checkChangelogLabel = async function (context) { | |||
'RUNNING CHANGELOG LABEL CHECK ON PULL REQUEST ' + | |||
pullRequestNumber | |||
); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded change
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in latest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@nlok5923 Frontend tests need to be fixed. |
@vojtechjelinek i had fixed the frontend test. |
There was a problem hiding this 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?
sure @jameesjohn |
yeah @jameesjohn this solution is partial actual solution need to listen to 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. |
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 . |
I think that's fine. What do you think @vojtechjelinek? |
I'm fine with closing this. |
closing this pr as the issue it's addressed is very rare. |
Fixes: #240
Explanation
Fixes tagging author after adding changelog label.
Checklist