Skip to content

Commit 29a085c

Browse files
committed
Add explicit section for untracked files
1 parent 3572b0c commit 29a085c

1 file changed

Lines changed: 73 additions & 29 deletions

File tree

  • .github/actions/check-concepts-up-to-date

.github/actions/check-concepts-up-to-date/action.yml

Lines changed: 73 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,15 @@ runs:
3636
3737
echo "out_of_date=true" >> "$GITHUB_OUTPUT"
3838
39-
# Persist the file list and diff for the check run + job summary.
40-
printf '%s\n' "$changes" > concept-drift-files.txt
39+
# Split drift into tracked modifications (which have a diff) and
40+
# untracked files (which do not — git diff never shows them). Untracked
41+
# files just mean a target dialect is missing a committed concept.
42+
tracked="$(printf '%s\n' "$changes" | grep -v '^?? ' || true)"
43+
untracked="$(printf '%s\n' "$changes" | grep '^?? ' | sed 's/^?? //' || true)"
44+
45+
# Persist for the check run step (runs in a separate shell).
46+
printf '%s\n' "$tracked" > concept-drift-files.txt
47+
printf '%s\n' "$untracked" > concept-untracked-files.txt
4148
git --no-pager diff -- ${{ inputs.paths }} > concept-drift.diff
4249
4350
{
@@ -53,21 +60,37 @@ runs:
5360
echo
5461
echo "…and commit the result, or let the regeneration bot open a PR after this merges."
5562
echo
56-
echo "<details><summary>Files that differ</summary>"
57-
echo
58-
echo '```'
59-
cat concept-drift-files.txt
60-
echo '```'
61-
echo
62-
echo "</details>"
63-
echo
64-
echo "<details><summary>Actual differences</summary>"
65-
echo
66-
echo '```diff'
67-
cat concept-drift.diff
68-
echo '```'
69-
echo
70-
echo "</details>"
63+
64+
if [ -n "$tracked" ]; then
65+
echo "<details><summary>Files that differ</summary>"
66+
echo
67+
echo '```'
68+
printf '%s\n' "$tracked"
69+
echo '```'
70+
echo
71+
echo "</details>"
72+
echo
73+
echo "<details><summary>Actual differences</summary>"
74+
echo
75+
echo '```diff'
76+
cat concept-drift.diff
77+
echo '```'
78+
echo
79+
echo "</details>"
80+
echo
81+
fi
82+
83+
if [ -n "$untracked" ]; then
84+
echo "<details><summary>Untracked files (missing from a target dialect)</summary>"
85+
echo
86+
echo "These files are not committed to git, so a target dialect is missing a concept. Regenerate and commit them:"
87+
echo
88+
echo '```'
89+
printf '%s\n' "$untracked"
90+
echo '```'
91+
echo
92+
echo "</details>"
93+
fi
7194
} >> "$GITHUB_STEP_SUMMARY"
7295
7396
- name: Report neutral check run when out of date
@@ -79,6 +102,7 @@ runs:
79102
const fs = require('fs');
80103
const read = (p) => fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : '';
81104
const files = read('concept-drift-files.txt').trim();
105+
const untracked = read('concept-untracked-files.txt').trim();
82106
let diff = read('concept-drift.diff');
83107
84108
// Check run output text is capped at 65535 chars; keep well under it.
@@ -91,7 +115,7 @@ runs:
91115
? context.payload.pull_request.head.sha
92116
: context.sha;
93117
94-
const summary = [
118+
const parts = [
95119
'The committed `concepts_postgres` / `concepts_duckdb` are stale relative to',
96120
'the BigQuery sources. Regenerate them by running:',
97121
'',
@@ -105,17 +129,37 @@ runs:
105129
'Alternatively, there is a bot which watches the main branch and',
106130
'automatically opens a PR to regenerate the dialects after the main',
107131
'branch merges.',
108-
'',
109-
'### Files that differ',
110-
'```',
111-
files,
112-
'```',
113-
'',
114-
'### Actual differences',
115-
'```diff',
116-
diff,
117-
'```',
118-
].join('\n');
132+
];
133+
134+
if (files) {
135+
parts.push(
136+
'',
137+
'### Files that differ',
138+
'```',
139+
files,
140+
'```',
141+
'',
142+
'### Actual differences',
143+
'```diff',
144+
diff,
145+
'```',
146+
);
147+
}
148+
149+
if (untracked) {
150+
parts.push(
151+
'',
152+
'### Untracked files (missing from a target dialect)',
153+
'These files are not committed to git, so a target dialect is missing a',
154+
'concept. Regenerate and commit them:',
155+
'',
156+
'```',
157+
untracked,
158+
'```',
159+
);
160+
}
161+
162+
const summary = parts.join('\n');
119163
120164
try {
121165
await github.rest.checks.create({

0 commit comments

Comments
 (0)