Skip to content

[Bug]I can't sign in to niconico. #4

[Bug]I can't sign in to niconico.

[Bug]I can't sign in to niconico. #4

Workflow file for this run

name: IssueBot
on:
issues:
types: [opened]
permissions:
issues: write
contents: read
jobs:
process_issue:
runs-on: ubuntu-latest
steps:
- name: Process issue
uses: actions/github-script@v6
with:
script: |
const issueBody = context.payload.issue.body;
const issueNumber = context.payload.issue.number;
const currentTitle = context.payload.issue.title;
const issueCreatedAt = new Date(context.payload.issue.created_at);
const templateKeyword = "**Checklist "; // Change this to a unique part of your template
// Define the cutoff date (year, month - 1, day)
const cutoffDate = new Date(2024, 11, 2); // December is month 11 (0-based index)
// Check if the issue was created after the cutoff date
if (issueCreatedAt > cutoffDate) {
// Step 1: Check if the issue body contains the template keyword
if (!issueBody.includes(templateKeyword)) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: "This issue does not follow the template and will be closed. Please update the issue following the template and reopen it."
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
state: "closed",
state_reason: "not_planned"
});
return; // Exit early if template not followed
}
// Step 2: Generate title if template is followed
try {
const titleResponse = await fetch('https://api.26163212.xyz:5001/generate-title', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
issue_number: issueNumber,
owner: "InfinityLoop1308",
repo: "PipePipe"
})
});
if (!titleResponse.ok) {
throw new Error(`Title generation failed: ${titleResponse.status}`);
}
const titleResult = await titleResponse.json();
console.log(titleResult)
const generatedTitle = titleResult.generated_result;
// Update title if different
if (generatedTitle !== currentTitle) {
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
title: generatedTitle
});
}
// Step 3: Analyze issue for related issues
const analyzeResponse = await fetch('https://api.26163212.xyz:5001/analyze-issue', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: generatedTitle,
owner: "InfinityLoop1308",
repo: "PipePipe"
})
});
if (!analyzeResponse.ok) {
throw new Error(`Issue analysis failed: ${analyzeResponse.status}`);
}
const analyzeResult = await analyzeResponse.json();
console.log(analyzeResult)
const relatedIssues = analyzeResult.related_issues;
// Handle related issues response
if (relatedIssues.length === 0) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: "✅ No similar issues found. This appears to be a unique issue."
});
} else {
const issueLinks = relatedIssues.map(num => `#${num}`).join(', ');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: `🔍 Found related issues: ${issueLinks}\n\nPlease check these issues first before proceeding.`
});
}
} catch (error) {
console.error('Error processing issue:', error);
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: "⚠️ There was an error processing this issue automatically. Please proceed manually."
});
}
}