Skip to content

Commit cd3b4b4

Browse files
authored
Update sync-issue-to-csv.yml
1 parent b1f5e40 commit cd3b4b4

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

.github/workflows/sync-issue-to-csv.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
issue_comment:
77
types: [created]
88
schedule:
9-
- cron: "*/10 * * * *" # 每10分钟兜底
9+
- cron: "*/10 * * * *"
1010
workflow_dispatch:
1111

1212
permissions:
@@ -29,13 +29,11 @@ jobs:
2929
const owner = context.repo.owner;
3030
const repo = context.repo.repo;
3131
32-
// ===== 读取 CSV =====
3332
let csv = fs.existsSync('tasks.csv') ? fs.readFileSync('tasks.csv', 'utf8') : "Project,Repo,Issue,Owner,PR,Status,Source\n";
3433
let lines = csv.split('\n').filter(line => line.trim() !== '');
3534
const header = lines[0];
3635
let rows = lines.slice(1);
3736
38-
// ===== 当前触发的 issue =====
3937
let issues = [];
4038
if (context.payload.issue) {
4139
issues = [context.payload.issue];
@@ -50,20 +48,16 @@ jobs:
5048
const issueNumber = issue.number;
5149
const issueUrl = `https://github.com/${owner}/${repo}/issues/${issueNumber}`;
5250
53-
// ===== Repo =====
5451
const repoMatch = body.match(/https:\/\/github\.com\/[^\s]+/);
5552
const repoUrl = repoMatch ? repoMatch[0] : "";
5653
if (!repoUrl) continue;
5754
58-
// ===== Owner =====
5955
const ownerMatch = body.match(/Owner:\s*@([^\s]+)/);
6056
const taskOwner = ownerMatch ? ownerMatch[1] : "";
6157
62-
// ===== PR =====
6358
const prMatch = body.match(/PR:\s*(https:\/\/[^\s]+)/);
6459
const prUrl = prMatch ? prMatch[1] : "";
6560
66-
// ===== Status =====
6761
let status = "";
6862
if (prUrl) {
6963
const mergedMatch = body.match(/Status:\s*(merged|closed|open)/i);
@@ -99,18 +93,17 @@ jobs:
9993
}
10094
}
10195
102-
// ===== 写回 CSV =====
10396
const newCsv = [header, ...rows].join('\n');
10497
fs.writeFileSync('tasks.csv', newCsv);
10598
106-
- name: Show CSV (Debug)
99+
- name: Show CSV
107100
run: cat tasks.csv
108101

109102
- name: Upload CSV artifact
110-
uses: actions/upload-artifact@v3
103+
uses: actions/upload-artifact@v4
111104
with:
112105
name: tasks-csv
113106
path: tasks.csv
114107

115-
- name: Skip push (Read-only)
108+
- name: Skip push
116109
run: echo "No write permission, CSV changes are local to runner"

0 commit comments

Comments
 (0)