File tree Expand file tree Collapse file tree 6 files changed +23
-55
lines changed
Expand file tree Collapse file tree 6 files changed +23
-55
lines changed Original file line number Diff line number Diff line change 22 "name" : " github-pr-tasklist-checker" ,
33 "version" : " 1.3.0" ,
44 "description" : " An Action to check if the PR tasklist is complete." ,
5- "main" : " src/index.js " ,
5+ "main" : " src/index.mjs " ,
66 "scripts" : {
7- "build" : " ncc build ./src/index.js --license license.txt -o dist" ,
8- "start" : " DEBUG=1 node src/index.js " ,
7+ "build" : " ncc build ./src/index.mjs --license license.txt -o dist" ,
8+ "start" : " DEBUG=1 node src/index.mjs " ,
99 "test" : " echo \" Error: no test specified\" && exit 1"
1010 },
1111 "repository" : {
Original file line number Diff line number Diff line change 1- // SPDX-FileCopyrightText: 2023 Awayume <dev@awayume.jp>
1+ // SPDX-FileCopyrightText: 2023-2025 Awayume <dev@awayume.jp>
22// SPDX-License-Identifier: MIT
33
4- 'use strict' ;
4+ import core from '@actions/core' ;
5+ import github from '@actions/github' ;
56
6- const core = require ( '@actions/core' ) ;
7- const github = require ( '@actions/github' ) ;
8-
9- const parser = require ( './parser' ) ;
10- const report = require ( './report' ) ;
7+ import { parse } from './parser.mjs' ;
8+ import { send } from './report.mjs' ;
119
1210
1311// For debugging
@@ -79,9 +77,9 @@ if (process.env.DEBUG) {
7977 // Get PR body
8078 const pr_body = context . payload . pull_request . body ;
8179 // Parse PR
82- const message = parser . parse ( pr_body ) ;
80+ const message = parse ( pr_body ) ;
8381 // Send a report
84- await report . send ( context , message ) ;
82+ await send ( context , message ) ;
8583
8684 if ( ! message . length ) {
8785 core . info ( 'All tasks are completed. Great!' ) ;
Original file line number Diff line number Diff line change 1- // SPDX-FileCopyrightText: 2025 Awayume <dev@awayume.jp>
1+ // SPDX-FileCopyrightText: 2023- 2025 Awayume <dev@awayume.jp>
22// SPDX-License-Identifier: MIT
33
4- 'use strict ';
4+ import { base_regex , Task } from './task.mjs ';
55
6- const { base_regex, Task } = require ( './task' ) ;
76
8-
9- const parse = pr_body => {
7+ export function parse ( pr_body ) {
108 // Parse PR body
119 const tasklist = [ ] ;
1210 let idt_unit = undefined ;
@@ -154,8 +152,3 @@ const parse = pr_body => {
154152
155153 return message ;
156154} ;
157-
158-
159- module . exports = Object . freeze ( {
160- parse,
161- } ) ;
Original file line number Diff line number Diff line change 1- // SPDX-FileCopyrightText: 2023 Awayume <dev@awayume.jp>
1+ // SPDX-FileCopyrightText: 2023-2025 Awayume <dev@awayume.jp>
22// SPDX-License-Identifier: MIT
33
4- 'use strict' ;
5-
6- const { getOctokit, maybeForbidden } = require ( './utils' ) ;
4+ import { getOctokit , maybeForbidden } from './utils.mjs' ;
75
86
97const message_sign = ' ' ;
108
119
12- const send = async ( context , message ) => {
10+ export async function send ( context , message ) {
1311 const octokit = getOctokit ( context ) ;
1412
1513 const comments = ( await maybeForbidden (
@@ -57,8 +55,3 @@ const send = async (context, message) => {
5755 } ;
5856 } ;
5957} ;
60-
61-
62- module . exports = Object . freeze ( {
63- send,
64- } ) ;
Original file line number Diff line number Diff line change 1- // SPDX-FileCopyrightText: 2023 Awayume <dev@awayume.jp>
1+ // SPDX-FileCopyrightText: 2023-2025 Awayume <dev@awayume.jp>
22// SPDX-License-Identifier: MIT
33
4- 'use strict' ;
5-
6- const base_regex = / - + \[ .] + / ;
4+ export const base_regex = / - + \[ .] + / ;
75const checked_regex = / - + \[ x ] + .+ / i;
86const choice_regex = / C h o i c e ( # .+ ) ? / ;
97const comment_regex = / < ! - - .* - - > / ;
@@ -12,7 +10,7 @@ const options_start = '<!--';
1210const options_end = '-->' ;
1311
1412
15- class Task {
13+ export class Task {
1614 constructor ( line ) {
1715 line = line . trim ( ) ;
1816
@@ -42,9 +40,3 @@ class Task {
4240 this . children = [ ] ;
4341 } ;
4442} ;
45-
46-
47- module . exports = Object . freeze ( {
48- base_regex,
49- Task,
50- } ) ;
Original file line number Diff line number Diff line change 1- // SPDX-FileCopyrightText: 2023 Awayume <dev@awayume.jp>
1+ // SPDX-FileCopyrightText: 2023-2025 Awayume <dev@awayume.jp>
22// SPDX-License-Identifier: MIT
33
4- 'use strict' ;
5-
6- const github = require ( '@actions/github' ) ;
4+ import github from '@actions/github' ;
75
86
97let octokit = undefined ;
108
11- const getOctokit = ( context ) => {
9+ export function getOctokit ( context ) {
1210 if ( ! octokit ) {
1311 octokit = github . getOctokit ( context . token ) ;
1412 Object . freeze ( octokit ) ;
@@ -17,7 +15,7 @@ const getOctokit = (context) => {
1715} ;
1816
1917
20- const maybeForbidden = async ( func , ...args ) => {
18+ export async function maybeForbidden ( func , ...args ) {
2119 try {
2220 return await func ( ...args ) ;
2321 } catch ( err ) {
@@ -36,9 +34,3 @@ const maybeForbidden = async (func, ...args) => {
3634 } ;
3735 }
3836} ;
39-
40-
41- module . exports = Object . freeze ( {
42- getOctokit,
43- maybeForbidden,
44- } ) ;
You can’t perform that action at this time.
0 commit comments