mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-12-27 00:11:30 -06:00
Compare commits
7 Commits
841f87564a
...
9061245887
Author | SHA1 | Date | |
---|---|---|---|
|
9061245887 | ||
|
31c6622926 | ||
|
e745d798b1 | ||
|
a29364984b | ||
|
07eeed310b | ||
|
8e00077e50 | ||
|
fc505872d2 |
61
.github/workflows/close-old-issues.yaml
vendored
61
.github/workflows/close-old-issues.yaml
vendored
@ -3,10 +3,12 @@ name: Close Inactive Issues
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # Run daily
|
||||
|
||||
workflow_dispatch: # This line enables manual triggering
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write # Ensure necessary permissions for issues
|
||||
|
||||
steps:
|
||||
- name: Close inactive issues
|
||||
@ -14,43 +16,50 @@ jobs:
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const octokit = github.getOctokit();
|
||||
const octokit = github;
|
||||
|
||||
// Get the repository owner and name
|
||||
const { owner, repo } = github.context.repo;
|
||||
const { owner, repo } = context.repo;
|
||||
|
||||
// Define the inactivity period (14 days)
|
||||
const inactivityPeriod = new Date();
|
||||
inactivityPeriod.setDate(inactivityPeriod.getDate() - 14);
|
||||
|
||||
async function run() {
|
||||
// Get all open issues
|
||||
const issues = await octokit.issues.listForRepo({
|
||||
try {
|
||||
// Get all open issues with pagination
|
||||
for await (const response of octokit.paginate.iterator(octokit.rest.issues.listForRepo, {
|
||||
owner,
|
||||
repo,
|
||||
state: 'open',
|
||||
});
|
||||
})) {
|
||||
const issues = response.data;
|
||||
|
||||
// Close issues inactive for more than the inactivity period
|
||||
for (const issue of issues.data) {
|
||||
const lastCommentDate = issue.updated_at;
|
||||
if (new Date(lastCommentDate) < inactivityPeriod) {
|
||||
// Close the issue and add a comment
|
||||
await octokit.issues.update({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
});
|
||||
// Close issues inactive for more than the inactivity period
|
||||
for (const issue of issues) {
|
||||
const lastCommentDate = issue.updated_at;
|
||||
if (new Date(lastCommentDate) < inactivityPeriod) {
|
||||
try {
|
||||
// Close the issue
|
||||
await octokit.rest.issues.update({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
});
|
||||
|
||||
await octokit.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
body: 'Closed due to inactivity',
|
||||
});
|
||||
// Add a comment
|
||||
await octokit.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
body: 'Closed due to inactivity',
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Error updating or commenting on issue #${issue.number}: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching issues: ${error}`);
|
||||
}
|
||||
|
||||
run().catch(error => console.error(error));
|
||||
|
@ -10,7 +10,7 @@
|
||||
Author : Chris Titus @christitustech
|
||||
Runspace Author: @DeveloperDurp
|
||||
GitHub : https://github.com/ChrisTitusTech
|
||||
Version : 24.02.07
|
||||
Version : 24.02.20
|
||||
#>
|
||||
param (
|
||||
[switch]$Debug,
|
||||
@ -47,7 +47,7 @@ Add-Type -AssemblyName System.Windows.Forms
|
||||
# Variable to sync between runspaces
|
||||
$sync = [Hashtable]::Synchronized(@{})
|
||||
$sync.PSScriptRoot = $PSScriptRoot
|
||||
$sync.version = "24.02.07"
|
||||
$sync.version = "24.02.20"
|
||||
$sync.configs = @{}
|
||||
$sync.ProcessRunning = $false
|
||||
|
||||
@ -7660,7 +7660,7 @@ $sync.configs.applications = '{
|
||||
"WPFInstallintelpresentmon": {
|
||||
"category": "Utilities",
|
||||
"choco": "na",
|
||||
"content": "Intel? PresentMon",
|
||||
"content": "Intel?? PresentMon",
|
||||
"description": "A new gaming performance overlay and telemetry application to monitor and measure your gaming experience.",
|
||||
"link": "https://game.intel.com/us/stories/intel-presentmon/",
|
||||
"winget": "Intel.PresentMon.Beta"
|
||||
|
Loading…
Reference in New Issue
Block a user