Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

add a new workflow with label for awaiting response

grohith327920e6b1d28bf
diff --git a/.github/policy/enforce-awaiting-response.mjs b/.github/policy/enforce-awaiting-response.mjs
new file mode 100644
index 00000000..b4cc4893
--- /dev/null
+++ b/.github/policy/enforce-awaiting-response.mjs
@@ -0,0 +1,116 @@
+import { readFileSync } from "node:fs";
+
+import {
+ ensureLabel,
+ githubRequest,
+ paginate,
+ repoContext,
+ upsertIssueComment,
+} from "./github-api.mjs";
+
+const LABEL = {
+ name: "awaiting response",
+ color: "FBCA04",
+ description: "Older issue will close after three days unless this label is removed.",
+};
+const CUTOFF = new Date("2026-07-08T00:00:00Z");
+const DAYS_BEFORE_CLOSE = 3;
+const WARNING_MARKER = "<!-- fluidvoice-awaiting-response-warning -->";
+const CLOSE_MARKER = "<!-- fluidvoice-awaiting-response-close -->";
+
+function eventPayload() {
+ return JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, "utf8"));
+}
+
+function isOlderIssue(issue) {
+ return !issue.pull_request && new Date(issue.created_at) < CUTOFF;
+}
+
+async function latestLabelTime(context, issueNumber) {
+ const events = await paginate(
+ `/repos/${context.owner}/${context.repo}/issues/${issueNumber}/events`,
+ );
+ const labelEvents = events.filter(
+ (event) => event.event === "labeled" && event.label?.name === LABEL.name,
+ );
+ const latest = labelEvents.reduce(
+ (current, event) =>
+ !current || new Date(event.created_at) > new Date(current.created_at)
+ ? event
+ : current,
+ null,
+ );
+ return latest ? new Date(latest.created_at) : null;
+}
+
+async function warnOrClose(context, issue, now = new Date()) {
+ if (!isOlderIssue(issue)) return;
+
+ const labeledAt = await latestLabelTime(context, issue.number);
+ if (!labeledAt) return;
+
+ const closesAt = new Date(
+ labeledAt.getTime() + DAYS_BEFORE_CLOSE * 24 * 60 * 60 * 1000,
+ );
+
+ if (now < closesAt) {
+ await upsertIssueComment(
+ context,
+ issue.number,
+ WARNING_MARKER,
+ [
+ "This issue is awaiting a response and will be closed three days after the label was applied.",
+ "",
+ "Remove the `awaiting response` label to cancel automatic closure.",
+ ].join("\n"),
+ );
+ return;
+ }
+
+ await upsertIssueComment(
+ context,
+ issue.number,
+ CLOSE_MARKER,
+ "Closing this issue because it remained labeled `awaiting response` for three days.",
+ );
+ await githubRequest(
+ "PATCH",
+ `/repos/${context.owner}/${context.repo}/issues/${issue.number}`,
+ { state: "closed", state_reason: "not_planned" },
+ );
+}
+
+async function scanLabeledIssues(context) {
+ const cutoff = CUTOFF.toISOString().slice(0, 10);
+ const query = encodeURIComponent(
+ `repo:${context.owner}/${context.repo} is:issue is:open created:<${cutoff} label:"${LABEL.name}"`,
+ );
+ let page = 1;
+
+ while (true) {
+ const results = await githubRequest(
+ "GET",
+ `/search/issues?q=${query}&per_page=100&page=${page}`,
+ );
+ for (const issue of results.items) await warnOrClose(context, issue);
+ if (results.items.length < 100) break;
+ page += 1;
+ }
+}
+
+async function main() {
+ const context = repoContext();
+ await ensureLabel(context, LABEL);
+
+ if (process.env.GITHUB_EVENT_NAME === "issues") {
+ const event = eventPayload();
+ if (event.action === "labeled" && event.label?.name === LABEL.name) {
+ await warnOrClose(context, event.issue);
+ }
+ return;
+ }
+
+ await scanLabeledIssues(context);
+}
+
+await main();
diff --git a/.github/workflows/awaiting-response.yml b/.github/workflows/awaiting-response.yml
new file mode 100644
index 00000000..bab4954a
--- /dev/null
+++ b/.github/workflows/awaiting-response.yml
@@ -0,0 +1,33 @@
+name: Close Older Issues Awaiting Response
+
+on:
+ issues:
+ types: [labeled]
+ schedule:
+ - cron: "17 * * * *"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ issues: write
+
+jobs:
+ awaiting-response:
+ name: Close older issues awaiting response
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout policy from default branch
+ uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.repository.default_branch }}
+ persist-credentials: false
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: "20"
+
+ - name: Enforce awaiting response policy
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: node .github/policy/enforce-awaiting-response.mjs
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 05982a8a..8f409181 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -33,10 +33,10 @@ jobs:
Add the `keep-open` or `pinned` label to prevent automatic closure.
close-issue-message: >
- Closing this issue because it remained inactive for 7 days after
+ Closing this issue because it remained inactive for 2 days after
being marked stale.
close-pr-message: >
- Closing this pull request because it remained inactive for 7 days
+ Closing this pull request because it remained inactive for 2 days
after being marked stale.
exempt-issue-labels: keep-open,pinned,needs reproduction
@@ -45,19 +45,3 @@ jobs:
remove-stale-when-updated: true
close-issue-reason: not_planned
delete-branch: false
-
- # Older issues are excluded from the general pass by start-date. Once a
- # maintainer labels one `awaiting response`, process it in this pass.
- - uses: actions/stale@v10
- with:
- days-before-stale: 0
- days-before-close: 3
- only-issue-labels: awaiting response
- stale-issue-label: stale
- stale-issue-message: >
- This issue is awaiting a response. It will be closed in 3 days if
- there is no further activity.
- close-issue-message: >
- Closing this issue because it remained awaiting a response for 3 days.
- remove-stale-when-updated: true
- close-issue-reason: not_planned