Skip to content

Commit 103f705

Browse files
authored
Merge pull request #1451 from datum-cloud/fix/seo-review-skip-no-changes-comment
fix: skip PR comment when seo-review has nothing to check
2 parents 98bb185 + f3461fe commit 103f705

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/seo-review.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ jobs:
109109
} >> "$GITHUB_OUTPUT"
110110
111111
- name: Run SEO review
112+
id: seo-review
112113
env:
113114
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
114115
SCAN_MODE: ${{ steps.mode.outputs.value }}
@@ -119,7 +120,7 @@ jobs:
119120
run: node scripts/seo-review.mjs
120121

121122
- name: Post or update PR comment
122-
if: github.event_name == 'pull_request'
123+
if: github.event_name == 'pull_request' && steps.seo-review.outputs.mode != 'skipped-no-changes'
123124
uses: marocchino/sticky-pull-request-comment@v3
124125
with:
125126
header: seo-review-bot

scripts/seo-review.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* SITE_URL default: https://www.datum.net (host used to recognise internal links)
1919
*/
2020

21-
import { readFile, writeFile, readdir, stat, mkdir } from 'node:fs/promises';
21+
import { readFile, writeFile, appendFile, readdir, stat, mkdir } from 'node:fs/promises';
2222
import path from 'node:path';
2323
import { load } from 'cheerio';
2424

@@ -804,6 +804,10 @@ async function main() {
804804
await writeFile(OUTPUT_FILE, body, 'utf8');
805805
console.log(`Wrote ${OUTPUT_FILE} (${body.length} bytes, ${picked.length} pages).`);
806806

807+
if (process.env.GITHUB_OUTPUT) {
808+
await appendFile(process.env.GITHUB_OUTPUT, `mode=${mode}\n`, 'utf8');
809+
}
810+
807811
if (tokenTotals.calls > 0) {
808812
const totalIn = tokenTotals.input + tokenTotals.cacheRead + tokenTotals.cacheCreate;
809813
const totalOut = tokenTotals.output;

0 commit comments

Comments
 (0)