1616 if : ${{ github.event.label.name == 'template-ignored' || github.event.label.name == 'template-missing' }}
1717 runs-on : ubuntu-latest
1818 steps :
19+ - uses : actions/checkout@v6
20+
1921 - name : Get PR template
2022 if : ${{ github.event.pull_request && github.event.label.name == 'template-missing' }}
2123 run : |
@@ -27,35 +29,10 @@ jobs:
2729 } >> $GITHUB_ENV
2830
2931 - name : Post comment
30- uses : actions/github-script@v6
32+ uses : actions/github-script@v8
33+ timeout-minutes : 2
3134 with :
3235 github-token : ${{ secrets.GITHUB_TOKEN }}
3336 script : |
34- const label = context.payload.label && context.payload.label.name;
35- if (!label) return;
36- const isPR = !!context.payload.pull_request;
37- const number = isPR ? context.payload.pull_request.number : context.payload.issue.number;
38-
39- let body = '';
40- if (label === 'template-ignored') {
41- body = 'Please fill in the template completely or at least as much as possible. The team needs more detailed information.';
42- } else if (label === 'template-missing') {
43- const kind = isPR ? 'PR' : 'issue';
44- let template;
45- if (isPR) {
46- template = '<details><summary>Raw template</summary>\n```\n' + process.env.PR_TEMPLATE + '\n```\n</details>';
47- } else {
48- template = '[Bug report template](https://raw.githubusercontent.com/TeamNewPipe/NewPipe/refs/heads/dev/.github/ISSUE_TEMPLATE/bug_report.yml), [Feature request template](https://raw.githubusercontent.com/TeamNewPipe/NewPipe/refs/heads/dev/.github/ISSUE_TEMPLATE/feature_request.yml)';
49- }
50- body = `Thank you for creating this ${kind}. Please edit your description and add the template with the information: ${template}`;
51- } else {
52- return;
53- }
54-
55- await github.rest.issues.createComment({
56- owner: context.repo.owner,
57- repo: context.repo.repo,
58- issue_number: number,
59- body
60- });
61-
37+ const script = require('.github/workflows/template-label.js');
38+ await script({github, context});
0 commit comments