Skip to content

Commit 405d5bf

Browse files
authored
Skip content pipeline PR if no docs changes (#60429)
1 parent e0c9dcb commit 405d5bf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/content-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ jobs:
103103
ID: ${{ matrix.id }}
104104
run: |
105105
git add content/ data/
106-
git add "src/content-pipelines/state/${ID}.sha"
107106
if git diff --cached --quiet; then
108107
echo "has_changes=false" >> "$GITHUB_OUTPUT"
109108
echo "No documentation changes to commit"
110109
else
110+
git add "src/content-pipelines/state/${ID}.sha"
111111
git commit -m "docs: update ${ID} content from source docs" \
112112
-m "Updated by the content-pipeline-update agent (${ID}) via GitHub Actions." \
113113
-m "Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

src/content-pipelines/scripts/update.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,14 @@ async function main(): Promise<void> {
224224
diff = '(diff unavailable)'
225225
}
226226

227+
// No source doc files changed — skip the agent.
228+
if (!nameStatus.startsWith('(') && !nameStatus.trim()) {
229+
console.log(
230+
`No changes in ${SOURCE_PATH} between ${storedSha.slice(0, 7)} and ${currentSha.slice(0, 7)}. Skipping agent run.`,
231+
)
232+
return
233+
}
234+
227235
diffContent = [
228236
`# Source doc changes (${storedSha.slice(0, 7)}..${currentSha.slice(0, 7)})`,
229237
'',

0 commit comments

Comments
 (0)