Compare commits

..

1 Commits

Author SHA1 Message Date
Tobias
bf438f3fc4 Create stale_pr_close.yml 2026-02-23 22:42:42 +01:00
4 changed files with 128 additions and 32 deletions

111
.github/workflows/stale_pr_close.yml generated vendored Normal file
View File

@@ -0,0 +1,111 @@
name: Stale PR Management
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
pull_request_target:
types:
- labeled
jobs:
stale-prs:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
contents: read
steps:
- name: Handle stale PRs
uses: actions/github-script@v7
with:
script: |
const now = new Date();
const owner = context.repo.owner;
const repo = context.repo.repo;
// --- When stale label is added, comment immediately ---
if (context.eventName === "pull_request_target" && context.payload.action === "labeled") {
const label = context.payload.label?.name;
if (label === "stale") {
const author = context.payload.pull_request.user.login;
await github.rest.issues.createComment({
owner,
repo,
issue_number: context.payload.pull_request.number,
body: `@${author} This PR has been marked as stale. It will be closed if no new commits are added in 7 days.`
});
}
return;
}
// --- Scheduled run: check all stale PRs ---
const { data: prs } = await github.rest.pulls.list({
owner,
repo,
state: "open",
per_page: 100
});
for (const pr of prs) {
const hasStale = pr.labels.some(l => l.name === "stale");
if (!hasStale) continue;
// Get timeline events to find when stale label was added
const { data: events } = await github.rest.issues.listEvents({
owner,
repo,
issue_number: pr.number,
per_page: 100
});
// Find the most recent time the stale label was added
const staleLabelEvents = events
.filter(e => e.event === "labeled" && e.label?.name === "stale")
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
if (staleLabelEvents.length === 0) continue;
const staleLabelDate = new Date(staleLabelEvents[0].created_at);
const daysSinceStale = (now - staleLabelDate) / (1000 * 60 * 60 * 24);
// Check for new commits since stale label was added
const { data: commits } = await github.rest.pulls.listCommits({
owner,
repo,
pull_number: pr.number
});
const lastCommitDate = new Date(commits[commits.length - 1].commit.author.date);
const author = pr.user.login;
// If there are new commits after the stale label, remove it
if (lastCommitDate > staleLabelDate) {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number: pr.number,
name: "stale"
});
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: `@${author} Recent activity detected. Removing stale label.`
});
}
// If 7 days have passed since stale label, close the PR
else if (daysSinceStale > 7) {
await github.rest.pulls.update({
owner,
repo,
pull_number: pr.number,
state: "closed"
});
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: `@${author} Closing stale PR due to inactivity (no commits for 7 days after stale label).`
});
}
}

View File

@@ -407,8 +407,6 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
</details>
## 2026-02-24
## 2026-02-23
### 🆕 New Scripts

View File

@@ -1,6 +0,0 @@
_____ _____________
/ ___/___ ____ __ _____ ___ ____/ / ____/ ___/
\__ \/ _ \/ __ `/ | /| / / _ \/ _ \/ __ / /_ \__ \
___/ / __/ /_/ /| |/ |/ / __/ __/ /_/ / __/ ___/ /
/____/\___/\__,_/ |__/|__/\___/\___/\__,_/_/ /____/

View File

@@ -1,5 +1,5 @@
{
"generated": "2026-02-24T00:22:35Z",
"generated": "2026-02-23T18:26:09Z",
"versions": [
{
"slug": "2fauth",
@@ -200,9 +200,9 @@
{
"slug": "cleanuparr",
"repo": "Cleanuparr/Cleanuparr",
"version": "v2.7.4",
"version": "v2.7.3",
"pinned": false,
"date": "2026-02-23T18:41:16Z"
"date": "2026-02-23T17:18:55Z"
},
{
"slug": "cloudreve",
@@ -382,9 +382,9 @@
{
"slug": "firefly",
"repo": "firefly-iii/firefly-iii",
"version": "v6.5.0",
"version": "v6.4.23",
"pinned": false,
"date": "2026-02-23T19:19:00Z"
"date": "2026-02-20T07:02:05Z"
},
{
"slug": "fladder",
@@ -438,9 +438,9 @@
{
"slug": "ghostfolio",
"repo": "ghostfolio/ghostfolio",
"version": "2.243.0",
"version": "2.242.0",
"pinned": false,
"date": "2026-02-23T19:31:36Z"
"date": "2026-02-22T10:01:44Z"
},
{
"slug": "gitea",
@@ -1138,9 +1138,9 @@
{
"slug": "pocketid",
"repo": "pocket-id/pocket-id",
"version": "v2.3.0",
"version": "v2.2.0",
"pinned": false,
"date": "2026-02-23T19:50:48Z"
"date": "2026-01-11T15:01:07Z"
},
{
"slug": "privatebin",
@@ -1345,13 +1345,6 @@
"pinned": false,
"date": "2026-02-12T14:20:56Z"
},
{
"slug": "seaweedfs",
"repo": "seaweedfs/seaweedfs",
"version": "4.13",
"pinned": false,
"date": "2026-02-17T01:09:45Z"
},
{
"slug": "seelf",
"repo": "YuukanOO/seelf",
@@ -1404,9 +1397,9 @@
{
"slug": "snipeit",
"repo": "grokability/snipe-it",
"version": "v8.4.0",
"version": "v8.3.7",
"pinned": false,
"date": "2026-02-23T20:59:43Z"
"date": "2025-12-12T09:13:40Z"
},
{
"slug": "snowshare",
@@ -1593,9 +1586,9 @@
{
"slug": "tunarr",
"repo": "chrisbenincasa/tunarr",
"version": "v1.1.16",
"version": "v1.1.15",
"pinned": false,
"date": "2026-02-23T21:24:47Z"
"date": "2026-02-19T23:51:17Z"
},
{
"slug": "uhf",
@@ -1642,9 +1635,9 @@
{
"slug": "vaultwarden",
"repo": "dani-garcia/vaultwarden",
"version": "1.35.4",
"version": "1.35.3",
"pinned": false,
"date": "2026-02-23T21:43:25Z"
"date": "2026-02-10T20:37:03Z"
},
{
"slug": "victoriametrics",
@@ -1747,9 +1740,9 @@
{
"slug": "wizarr",
"repo": "wizarrrr/wizarr",
"version": "v2026.2.0",
"version": "v2025.12.0",
"pinned": false,
"date": "2026-02-23T19:25:28Z"
"date": "2025-12-09T14:30:23Z"
},
{
"slug": "writefreely",