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

tools: notify on Slack when invalid commit lands #47178

Merged
merged 2 commits into from
Mar 23, 2023

Conversation

aduh95
Copy link
Contributor

@aduh95 aduh95 commented Mar 20, 2023

Check every commits that land on main with core-validate-commit and send a message on Slack if it reports and error. If the commit title contains a reference to a PR in the format that GitHub uses by default, it also adds a comment to the PR.

Refs: #47111 (comment)

/cc @nodejs/tsc

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Mar 20, 2023
Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

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

It looks like there was a relatively recent commit (30d92e8) that this would have caught.

.github/workflows/notify-on-push.yml Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Co-authored-by: Chengzhong Wu <[email protected]>
Co-authored-by: Rich Trott <[email protected]>
@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Mar 23, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 23, 2023
@nodejs-github-bot nodejs-github-bot merged commit 8200304 into nodejs:main Mar 23, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 8200304

@aduh95 aduh95 deleted the notify-invalid-commit branch March 23, 2023 09:40
@tniessen
Copy link
Member

@aduh95 This is failing on every commit on main:

2023-03-23T15:02:14.2287511Z /home/runner/.npm/_npx/6e11f47436a5ebf9/node_modules/core-validate-commit/bin/cmd.js:154
2023-03-23T15:02:14.2288068Z     if (err) throw err
2023-03-23T15:02:14.2288380Z              ^
2023-03-23T15:02:14.2293763Z 
2023-03-23T15:02:14.2294423Z Error: Command failed: git show --quiet --format=medium f51c152f6016fdf9ad9ec6ee246f83a7b4793043
2023-03-23T15:02:14.2296634Z fatal: not a git repository (or any of the parent directories): .git
2023-03-23T15:02:14.2297302Z 
2023-03-23T15:02:14.2297652Z     at ChildProcess.exithandler (node:child_process:419:12)
2023-03-23T15:02:14.2298370Z     at ChildProcess.emit (node:events:513:28)
2023-03-23T15:02:14.2300984Z     at maybeClose (node:internal/child_process:1091:16)
2023-03-23T15:02:14.2301585Z     at Socket.<anonymous> (node:internal/child_process:449:11)
2023-03-23T15:02:14.2302024Z     at Socket.emit (node:events:513:28)
2023-03-23T15:02:14.2352414Z     at Pipe.<anonymous> (node:net:322:12) {
2023-03-23T15:02:14.2352748Z   code: 128,
2023-03-23T15:02:14.2353070Z   killed: false,
2023-03-23T15:02:14.2353359Z   signal: null,
2023-03-23T15:02:14.2353843Z   cmd: 'git show --quiet --format=medium f51c152f6016fdf9ad9ec6ee246f83a7b4793043'
2023-03-23T15:02:14.2354206Z }
2023-03-23T15:02:14.2354351Z 
2023-03-23T15:02:14.2354505Z Node.js v18.15.0
2023-03-23T15:02:14.2731777Z ##[group]Run node <<<'EOF'
2023-03-23T15:02:14.2732155Z �[36;1mnode <<<'EOF'�[0m
2023-03-23T15:02:14.2732592Z �[36;1mconst invalidCommitMessageMatch = /\s\(\#\d+\)$/.exec(process.env.COMMIT_MESSAGE);�[0m
2023-03-23T15:02:14.2732986Z �[36;1mif (match == null) process.exit(1)�[0m
2023-03-23T15:02:14.2733332Z �[36;1mconsole.log(`PR_ID=${match[0]}`)�[0m
2023-03-23T15:02:14.2733821Z �[36;1mEOF >> $GITHUB_ENV || true�[0m
2023-03-23T15:02:14.2786579Z shell: /usr/bin/bash -e {0}
2023-03-23T15:02:14.2786898Z env:
2023-03-23T15:02:14.2787182Z   INVALID_COMMIT_MESSAGE: 1
2023-03-23T15:02:14.2787825Z   COMMIT_MESSAGE: util: reduce javascript call for ToUSVString

PR-URL: https://github.com/nodejs/node/pull/47192
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
2023-03-23T15:02:14.2788303Z ##[endgroup]
2023-03-23T15:02:14.3230731Z [stdin]:1
2023-03-23T15:02:14.3233009Z EOF
2023-03-23T15:02:14.3233426Z ^
2023-03-23T15:02:14.3233963Z 
2023-03-23T15:02:14.3234300Z ReferenceError: EOF is not defined
2023-03-23T15:02:14.3234560Z     at [stdin]:1:1
2023-03-23T15:02:14.3234816Z     at Script.runInThisContext (node:vm:129:12)
2023-03-23T15:02:14.3235106Z     at Object.runInThisContext (node:vm:307:38)
2023-03-23T15:02:14.3235394Z     at node:internal/process/execution:79:19
2023-03-23T15:02:14.3235836Z     at [stdin]-wrapper:6:22
2023-03-23T15:02:14.3236102Z     at evalScript (node:internal/process/execution:78:60)
2023-03-23T15:02:14.3236382Z     at node:internal/main/eval_stdin:30:5
2023-03-23T15:02:14.3236671Z     at Socket.<anonymous> (node:internal/process/execution:195:5)
2023-03-23T15:02:14.3236955Z     at Socket.emit (node:events:525:35)
2023-03-23T15:02:14.3237231Z     at endReadableNT (node:internal/streams/readable:1359:12)
2023-03-23T15:02:14.3237411Z 
2023-03-23T15:02:14.3237489Z Node.js v18.15.0
2023-03-23T15:02:14.3270572Z ##[error]Process completed with exit code 1.

Looks like it might be more than one error causing this.

RafaelGSS pushed a commit that referenced this pull request Apr 5, 2023
PR-URL: #47178
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Debadree Chatterjee <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Tierney Cyren <[email protected]>
Reviewed-By: Akhil Marsonya <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@RafaelGSS RafaelGSS mentioned this pull request Apr 6, 2023
RafaelGSS pushed a commit that referenced this pull request Apr 7, 2023
PR-URL: #47178
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Debadree Chatterjee <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Tierney Cyren <[email protected]>
Reviewed-By: Akhil Marsonya <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
PR-URL: #47178
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Debadree Chatterjee <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Tierney Cyren <[email protected]>
Reviewed-By: Akhil Marsonya <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.