Skip to content

Commit 3f61ce4

Browse files
committed
chore: revert for now and make the script fail in CI
1 parent 92d0ef4 commit 3f61ce4

File tree

2 files changed

+7
-44
lines changed

2 files changed

+7
-44
lines changed

.github/workflows/check-deno.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Deno
22

33
on:
4-
pull_request_target:
4+
pull_request:
55
types:
66
- opened
77
- synchronize
Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
/* eslint-disable @typescript-eslint/restrict-template-expressions */
22
import { execSync } from 'node:child_process';
3-
import { readFile } from 'node:fs/promises';
43
import process from 'node:process';
5-
import { Octokit } from '@octokit/action';
64

7-
const octokit = new Octokit();
85
const [OWNER, REPOSITORY] = process.env.GITHUB_REPOSITORY.split('/');
96

107
const commitUrl = `https://github.com/${OWNER}/${REPOSITORY}/commit/${process.env.GITHUB_SHA}`;
118

12-
/** @type {import('@octokit/webhooks-types').PullRequestOpenedEvent | import('@octokit/webhooks-types').PullRequestSynchronizeEvent} */
13-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
14-
const prEvent = JSON.parse(await readFile(process.env.GITHUB_EVENT_PATH, 'utf8'));
15-
16-
const {
17-
pull_request: {
18-
number,
19-
user: { login },
20-
},
21-
} = prEvent;
22-
239
console.info(`👀 Verifying that deno types are up to date with commit ${process.env.GITHUB_SHA}`);
2410
console.debug('Running build:deno script');
2511
execSync(`npm run build:deno`);
@@ -32,53 +18,30 @@ const diff = execSync(`git diff --name-only ${process.env.GITHUB_SHA}`)
3218

3319
if (!diff.length) {
3420
console.info('✅ Nothing to do here!');
35-
const allReviews = await octokit.pulls.listReviews({
36-
owner: OWNER,
37-
pull_number: number,
38-
repo: REPOSITORY,
39-
});
40-
41-
const lastReviewByBot = allReviews.data.filter((item) => item.user?.id === 41_898_282).at(-1);
42-
43-
if (lastReviewByBot?.state === 'CHANGES_REQUESTED') {
44-
await octokit.pulls.dismissReview({
45-
owner: OWNER,
46-
repo: REPOSITORY,
47-
pull_number: number,
48-
message: 'No longer applicable as deno types are in sync once again! 🎉',
49-
review_id: lastReviewByBot.id,
50-
});
51-
}
5221

5322
process.exit(0);
5423
}
5524

5625
console.debug(`⚠️ Found ${diff.length} different files.`, { diff });
5726

5827
const messageBody = [
59-
`Hey @${login}! Taking a look at commit ${commitUrl}, it seems that you forgot to run \`npm run build:deno\`. Here are the files that are different from the base:`,
28+
`Taking a look at commit ${commitUrl}, it seems that you forgot to run \`npm run build:deno\`. Here are the files that are different from the base:`,
6029
'',
6130
];
6231

6332
for (const file of diff) {
6433
messageBody.push(
65-
`- [Node: \`${file.slice(5)}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
34+
`- \`${file.slice(5)}\`: Node (https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
6635
process.env.GITHUB_SHA
67-
}/${file.slice(5)}) - [Deno: \`${file}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
36+
}/${file.slice(5)}) - Deno (https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
6837
process.env.GITHUB_SHA
6938
}/${file})`,
7039
);
7140
}
7241

7342
messageBody.push('', 'Please run `npm run build:deno` and commit the results to update the deno types.');
7443

75-
console.info('🔈 Requesting changes in the pull request');
76-
await octokit.pulls.createReview({
77-
event: 'REQUEST_CHANGES',
78-
body: messageBody.join('\n'),
79-
owner: OWNER,
80-
repo: REPOSITORY,
81-
pull_number: number,
82-
});
44+
console.error('❌ Deno types are not up to date with the commit!');
45+
console.error(messageBody.join('\n'));
8346

84-
console.info('✅ Done!');
47+
process.exit(1);

0 commit comments

Comments
 (0)