Skip to content

Commit 5e43e9f

Browse files
committed
Add an optional message config parameter for warning and unassign messages so that they sound friendly
1 parent 8647c8c commit 5e43e9f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,18 @@ inputs:
99
description: 'Number of hours to wait before unassigning an issue'
1010
required: false
1111
default: 168 # 7 days
12+
unassign_inactive_message:
13+
description: 'Message posted on issue when unassigning'
14+
required: false
15+
default: "You’ve just been unassigned from this ticket due to inactivity – but feel free to pick it back up (or a new one!) in the future! Thank you again for your contribution to this project."
1216
warning_inactive_in_hours:
1317
description: 'Number of hours to wait before posting a warning message in an issue'
1418
required: false
1519
default: 120 # 5 days
20+
warning_inactive_message:
21+
description: 'Message posted on issue as unassign warning'
22+
required: false
23+
default: "Thanks for picking up this issue and supporting this project! It looks like there hasn’t been any activity on this ticket in a while. To keep things moving, you will be unassigned from this issue soon if there’s no new activity on it by then. But we encourage you to pick this issue (or a new one) back up in the future!"
1624
runs:
1725
using: 'node12'
1826
main: 'index.js'

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const core = require('@actions/core');
22
const github = require('@actions/github');
33
const token = core.getInput('token');
44
const unassignInactiveInHours = core.getInput('unassign_inactive_in_hours');
5+
const unassignInactiveMessage = core.getInput('unassign_inactive_message');
56
const warningInactiveInHours = core.getInput('warning_inactive_in_hours');
7+
const warningInactiveMessage = core.getInput('warning_inactive_message');
68
const repoOwner = github.context.repo.owner;
79
const repo = github.context.repo.repo;
810
const octokit = github.getOctokit(token);
@@ -117,11 +119,12 @@ async function main() {
117119
// Unassign the issue //
118120
////////////////////////
119121
// Post a message
120-
const body = `This issue has been inactive for ${timeInactiveInHours} ` +
122+
const body = `This issue has been inactive for ${timeInactiveInHours} ` +
121123
`hours (${(timeInactiveInHours/24).toFixed(2)} days) ` +
122124
`and is past the limit of ${unassignInactiveInHours} ` +
123125
`hours (${(unassignInactiveInHours/24).toFixed(2)} days) ` +
124-
`so is being unassigned.`;
126+
`so is being unassigned.` +
127+
`${unassignInactiveMessage} \n `
125128
try {
126129
await octokit.issues.createComment({
127130
owner: repoOwner,
@@ -172,7 +175,8 @@ async function main() {
172175
const body = `This issue has been inactive for ${timeInactiveInHours} ` +
173176
`hours (${(timeInactiveInHours/24).toFixed(2)} days) ` +
174177
`and will be automatically unassigned after ${willBeUnassignedInHours} ` +
175-
`more hours (${(willBeUnassignedInHours/24).toFixed(2)} days).`;
178+
`more hours (${(willBeUnassignedInHours/24).toFixed(2)} days).` +
179+
`${warningInactiveMessage}`;
176180
try {
177181
await octokit.issues.createComment({
178182
owner: repoOwner,

0 commit comments

Comments
 (0)