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

Project Management Automation: Commit-to-master fails addMilestone task #20144

Closed
aduth opened this issue Feb 10, 2020 · 0 comments · Fixed by #20147
Closed

Project Management Automation: Commit-to-master fails addMilestone task #20144

aduth opened this issue Feb 10, 2020 · 0 comments · Fixed by #20147
Assignees
Labels
[Package] Project management automation /packages/project-management-automation [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@aduth
Copy link
Member

aduth commented Feb 10, 2020

Related: #20058

Describe the bug

Direct commits to the master branch will result in a failing action for the addMilestone task.

See: https://github.com/WordPress/gutenberg/runs/436475328

main: Received event = 'push', action = 'undefined'
main: Starting task addMilestone
##[error]main: Task addMilestone failed with error: TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
main: All done!
##[error]Node run failed with exit code 1

While commits to master are discouraged and should be rare occurrences, the action should be able to handle this gracefully.

Based on the error message, I suspect that the issue is that String#match will return null when there is no match:

const [ , prNumber ] = payload.commits[ 0 ].message.match( /\(#(\d+)\)$/m );

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match#Return_value

Before deconstructing the array members, this should check that the result would be non-null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Project management automation /packages/project-management-automation [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants