Skip to content

Commit 4296aaa

Browse files
committedMar 8, 2024
chore: update issue-handling
1 parent 445217c commit 4296aaa

File tree

2 files changed

+15
-33
lines changed

2 files changed

+15
-33
lines changed
 
+11-26
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,13 @@
1-
const commitShaRegExp = /commit\/(?<sha>\w{40})/gm;
1+
import { readFileSync } from 'node:fs';
22

3-
module.exports = async function run({
4-
github,
5-
context,
6-
version
7-
}) {
8-
const {
9-
data: release
10-
} = await github.repos.getReleaseByTag({
11-
owner: context.repo.owner,
12-
repo: context.repo.repo,
13-
tag: `v${version}`
14-
});
15-
release.url = release.html_url;
3+
export default async function run({ github, context }) {
4+
const { version } = JSON.parse(readFileSync(new URL('../lerna.json', import.meta.url)).toString());
165

17-
console.log(release);
18-
// const commits = [];
19-
// let result;
20-
// do {
21-
// result = commitShaRegExp.exec(release.body);
22-
// if (result && result.groups && result.groups.sha) {
23-
// commits.push({
24-
// hash: result.groups.sha
25-
// });
26-
// }
27-
// } while (result);
28-
};
6+
const { data: release } = await github.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
7+
owner: context.repo.owner,
8+
repo: context.repo.repo,
9+
tag: `v${version}`
10+
});
11+
12+
console.log(release);
13+
}

‎.github/workflows/issues-handling.yaml

+4-7
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@ jobs:
1919
run: yarn --frozen-lockfile
2020

2121
- name: Add release comments to issues and PRs
22-
uses: actions/github-script@v6
22+
uses: actions/github-script@v7
2323
env:
2424
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2525
with:
2626
script: |
27-
const { readFileSync } = require('fs');
28-
const { URL } = require('url');
29-
const { version } = require('./lerna.json');
30-
console.log('Create issue comments for lerna version: ', version);
31-
const script = require('./.github/actions/createIssueComments.cjs');
32-
аwait script({ github: github.rest, context, core, version })
27+
const { default: addIssueComments } = await import('${{ github.workspace }}/.github/createIssueComments.mjs');
28+
29+
await addIssueComments({ github, context })

0 commit comments

Comments
 (0)