|
8 | 8 | close-not-reproducible-issues: |
9 | 9 | runs-on: ubuntu-latest |
10 | 10 | steps: |
11 | | - - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
12 | | - env: |
13 | | - BODY: > |
14 | | - Thanks for raising this issue 🙏<br /> |
15 | | - <br /> |
16 | | - Unfortunately, we are closing the issue as no reproducible samples were provided within 7 days.<br /> |
17 | | - If there are any updates, please reopen this issue or create new one.<br /> |
18 | | - <br /> |
19 | | - If you have any questions please reach out to us on our [Discord](https://discord.webdriver.io/)<br /> |
20 | | - channel. We are happy to help you out there. |
| 11 | + - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 |
21 | 12 | with: |
22 | | - github-token: ${{ secrets.WDIO_BOT_GITHUB_TOKEN }} |
23 | | - script: | |
24 | | - const labelName = 'Reproducible Example Missing' |
25 | | - const daysBeforeClose = 7 |
26 | | - const perPage = 100 |
27 | | -
|
28 | | - const now = new Date() |
29 | | - const msInDay = 24 * 60 * 60 * 1000 |
30 | | - const iterator = github.paginate.iterator(github.rest.issues.listForRepo, { |
31 | | - owner: context.repo.owner, |
32 | | - repo: context.repo.repo, |
33 | | - state: 'open', |
34 | | - labels: [labelName], |
35 | | - per_page: perPage, |
36 | | - }) |
37 | | -
|
38 | | - for await (const { data: issues } of iterator) { |
39 | | - for (const issue of issues) { |
40 | | - if (issue.pull_request) { |
41 | | - continue |
42 | | - } |
43 | | -
|
44 | | - const events = await github.paginate( |
45 | | - github.rest.issues.listEventsForTimeline, |
46 | | - { |
47 | | - owner: context.repo.owner, |
48 | | - repo: context.repo.repo, |
49 | | - issue_number: issue.number, |
50 | | - per_page: perPage |
51 | | - } |
52 | | - ) |
53 | | -
|
54 | | - const labelEvent = events.find( |
55 | | - e => e.event === 'labeled' && e.label?.name === labelName |
56 | | - ) |
| 13 | + repo-token: ${{ secrets.WDIO_BOT_GITHUB_TOKEN }} |
| 14 | + only-issue-labels: 'Reproducible Example Missing' |
| 15 | + days-before-close: 7 |
| 16 | + days-before-stale: -1 |
| 17 | + close-issue-message: > |
| 18 | + Thanks for raising this issue 🙏 |
57 | 19 |
|
58 | | - if (!labelEvent) { |
59 | | - continue |
60 | | - } |
| 20 | + Unfortunately, we are closing the issue as no reproducible samples were provided within 7 days. |
| 21 | + If there are any updates, please reopen this issue or create new one. |
61 | 22 |
|
62 | | - const labeledAt = new Date(labelEvent.created_at) |
63 | | - const updatedAt = new Date(issue.updated_at) |
64 | | - const targetDate = updatedAt > labeledAt ? updatedAt : labeledAt |
65 | | -
|
66 | | - const diffDays = Math.floor((now - targetDate) / msInDay) |
67 | | - if (diffDays >= daysBeforeClose) { |
68 | | - console.log(`Closing issue #${issue.number} (inactive ${diffDays} days after label)`) |
69 | | -
|
70 | | - await github.rest.issues.createComment({ |
71 | | - owner: context.repo.owner, |
72 | | - repo: context.repo.repo, |
73 | | - issue_number: issue.number, |
74 | | - body: process.env.BODY, |
75 | | - }) |
76 | | -
|
77 | | - await github.rest.issues.update({ |
78 | | - owner: context.repo.owner, |
79 | | - repo: context.repo.repo, |
80 | | - issue_number: issue.number, |
81 | | - state: 'closed' |
82 | | - }) |
83 | | - } |
84 | | - } |
85 | | - } |
| 23 | + If you have any questions please reach out to us on our [Discord](https://discord.webdriver.io/) |
| 24 | + channel. We are happy to help you out there. |
0 commit comments