Skip to content

Commit 648c809

Browse files
authored
ci(workflows): log on changelog/tests needed (aws#5506)
## Problem we can't run the change/test action from a fork :( ## Solution Just log the information instead --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 24c55fe commit 648c809

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

.github/workflows/notify.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
const { parsePRTitle, hasPath, dedupComment } = require('./utils')
6+
const { parsePRTitle, hasPath } = require('./utils')
77

88
const testFilesMessage =
99
'This pull request modifies files in src/ but no tests were added/updated. Confirm whether tests should be added or ensure the PR description explains why tests are not required.'
@@ -21,7 +21,6 @@ module.exports = async ({ github, context }) => {
2121
const owner = context.repo.owner
2222
const repo = context.repo.repo
2323
const author = context.payload.pull_request.head.repo.owner.login
24-
const pullRequestId = context.payload.pull_request.number
2524

2625
const response = await github.rest.repos.compareCommitsWithBasehead({
2726
owner,
@@ -38,19 +37,13 @@ module.exports = async ({ github, context }) => {
3837
return
3938
}
4039

41-
// Check for prior comments on the PR
42-
const comments = await github.rest.issues.listComments({
43-
owner,
44-
repo,
45-
issue_number: pullRequestId,
46-
})
47-
4840
if (shouldAddTestFileMessage) {
49-
await dedupComment({ github, comments, owner, repo, pullRequestId, message: testFilesMessage })
41+
// We can't really block on this one, since its valid to make a change in src/ without adding tests :( console.error(testFilesMessage)
5042
}
5143

5244
if (shouldAddChangelogMessage) {
53-
await dedupComment({ github, comments, owner, repo, pullRequestId, message: changelogMessage })
45+
console.error(changelogMessage)
46+
process.exit(1)
5447
}
5548
}
5649

.github/workflows/utils.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ function parsePRTitle(title) {
2525
}
2626
}
2727

28-
/**
29-
* Create a comment on a PR if one does not already exist
30-
*/
31-
async function dedupComment({ github, pullRequestId, owner, repo, comments, message }) {
32-
if (comments.data.some((comment) => comment.body.includes(message))) {
33-
return
34-
}
35-
36-
await github.rest.issues.createComment({
37-
issue_number: pullRequestId,
38-
owner,
39-
repo,
40-
body: message,
41-
})
42-
}
43-
4428
/*
4529
* Check if path is included in at least one of the filename paths
4630
*/
@@ -50,6 +34,5 @@ function hasPath(filenames, path) {
5034

5135
module.exports = {
5236
parsePRTitle,
53-
dedupComment,
5437
hasPath,
5538
}

0 commit comments

Comments
 (0)