mirror of
https://github.com/trustno1-coder/VIctory-NVIDIA.git
synced 2026-12-06 09:08:35 +00:00
needs-logs: take the label off when the author adds the logs
The label was never removed, so it stayed on issues that now have logs. Edits and comments by the issue's author are now checked with the same log test. A manual run checks every open issue that has the label. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
48
.github/workflows/needs-logs.yml
vendored
48
.github/workflows/needs-logs.yml
vendored
@ -1,13 +1,22 @@
|
||||
# Asks for the logs when a new issue has none: no attached file and no pasted log lines.
|
||||
# Takes the label off once the issue's author adds them, in the issue or in a comment. Run it by
|
||||
# hand to check every open issue that has the label.
|
||||
name: needs-logs
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
types: [opened, edited]
|
||||
issue_comment:
|
||||
types: [created, edited]
|
||||
workflow_dispatch:
|
||||
permissions:
|
||||
issues: write
|
||||
jobs:
|
||||
ask:
|
||||
if: github.event.issue.user.login != github.repository_owner
|
||||
if: >-
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(github.event.action == 'opened' && github.event.issue.user.login != github.repository_owner) ||
|
||||
(github.event.action != 'opened' && contains(github.event.issue.labels.*.name, 'needs-logs') &&
|
||||
github.event.sender.id == github.event.issue.user.id)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
@ -21,11 +30,38 @@ jobs:
|
||||
Also say which GPU, Windows version (10 or 11)
|
||||
with:
|
||||
script: |
|
||||
const body = context.payload.issue.body || '';
|
||||
const { owner, repo } = context.repo;
|
||||
const p = context.payload;
|
||||
// An attached file (GitHub's upload links) or pasted log lines count as logs.
|
||||
const attached = /https:\/\/github\.com\/(user-attachments\/files|[^\/\s]+\/[^\/\s]+\/files)\//.test(body);
|
||||
const pasted = /victory_gpu::|victory_hle::|unhandled exception|crashes\.log:|\b(INFO|WARN|ERROR)\s+victory|\.(dll|exe)\+0x[0-9a-f]+|\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d/i.test(body);
|
||||
if (attached || pasted) return;
|
||||
const hasLogs = (text) => /https:\/\/github\.com\/(user-attachments\/files|[^\/\s]+\/[^\/\s]+\/files)\//.test(text || '') ||
|
||||
/victory_gpu::|victory_hle::|unhandled exception|crashes\.log:|\b(INFO|WARN|ERROR)\s+victory|\.(dll|exe)\+0x[0-9a-f]+|\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d/i.test(text || '');
|
||||
const unlabel = async (issue_number) => {
|
||||
try {
|
||||
await github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'needs-logs' });
|
||||
} catch (e) {
|
||||
if (e.status !== 404) throw e; // 404: the label is already off
|
||||
}
|
||||
};
|
||||
if (context.eventName === 'workflow_dispatch') {
|
||||
const issues = await github.paginate(github.rest.issues.listForRepo,
|
||||
{ owner, repo, state: 'open', labels: 'needs-logs', per_page: 100 });
|
||||
for (const issue of issues) {
|
||||
if (issue.pull_request) continue;
|
||||
let found = hasLogs(issue.body);
|
||||
if (!found && issue.comments && issue.user) {
|
||||
const comments = await github.paginate(github.rest.issues.listComments,
|
||||
{ owner, repo, issue_number: issue.number, per_page: 100 });
|
||||
found = comments.some((c) => c.user?.id === issue.user.id && hasLogs(c.body));
|
||||
}
|
||||
if (found) await unlabel(issue.number);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (p.action !== 'opened') {
|
||||
if (hasLogs((p.comment || p.issue).body)) await unlabel(p.issue.number);
|
||||
return;
|
||||
}
|
||||
if (hasLogs(p.issue.body)) return;
|
||||
await github.rest.issues.addLabels({
|
||||
owner: context.repo.owner, repo: context.repo.repo,
|
||||
issue_number: context.issue.number, labels: ['needs-logs'],
|
||||
|
||||
Reference in New Issue
Block a user