@@ -24,7 +24,8 @@ permissions:
24
24
jobs :
25
25
download :
26
26
runs-on : ubuntu-latest
27
- if : ${{ github.event.workflow_run.conclusion == 'success' }}
27
+ # FIXME(feature freeze): Make sure to remove that last part after the feature freeze is over
28
+ if : ${{ github.event.workflow_run.conclusion == 'success' && ! contains(github.event.pull_request.labels.*.name, 'A-new-lint') }}
28
29
steps :
29
30
- name : Download artifact
30
31
uses : actions/download-artifact@v4
@@ -40,54 +41,54 @@ jobs:
40
41
script : |
41
42
const fs = require("fs");
42
43
const assert = require("assert/strict");
43
-
44
+
44
45
function validateName(s) {
45
46
assert.match(s, /^[a-z0-9_:]+$/);
46
47
return s;
47
48
}
48
-
49
+
49
50
function validateInt(i) {
50
51
assert.ok(Number.isInteger(i));
51
52
return i;
52
53
}
53
-
54
+
54
55
function tryReadSummary() {
55
56
try {
56
57
return JSON.parse(fs.readFileSync("untrusted/summary.json"));
57
58
} catch {
58
59
return null;
59
60
}
60
61
}
61
-
62
+
62
63
const prNumber = parseInt(fs.readFileSync("untrusted/pr.txt"), 10);
63
64
core.exportVariable("PR", prNumber.toString());
64
-
65
+
65
66
const untrustedSummary = tryReadSummary();
66
67
if (!Array.isArray(untrustedSummary)) {
67
68
return;
68
69
}
69
-
70
+
70
71
let summary = `Lintcheck changes for ${context.payload.workflow_run.head_sha}
71
72
72
73
| Lint | Added | Removed | Changed |
73
74
| ---- | ----: | ------: | ------: |
74
75
`;
75
-
76
+
76
77
for (const untrustedRow of untrustedSummary) {
77
78
const name = validateName(untrustedRow.name);
78
-
79
+
79
80
const added = validateInt(untrustedRow.added);
80
81
const removed = validateInt(untrustedRow.removed);
81
82
const changed = validateInt(untrustedRow.changed);
82
83
83
84
const id = name.replace("clippy::", "user-content-").replaceAll("_", "-");
84
85
const url = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${context.payload.workflow_run.id}#${id}`;
85
-
86
+
86
87
summary += `| [\`${name}\`](${url}) | ${added} | ${removed} | ${changed} |\n`;
87
88
}
88
-
89
+
89
90
summary += "\nThis comment will be updated if you push new changes";
90
-
91
+
91
92
fs.writeFileSync("summary.md", summary);
92
93
93
94
- name : Create/update comment
0 commit comments