This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 91fbc276704 [fix](ci) Avoid website builds for Action maintenance
changes (#4689)
91fbc276704 is described below
commit 91fbc2767042945fc82eacfa49507dfe20f8a82f
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Mon Nov 23 23:20:11 2026 +0800
[fix](ci) Avoid website builds for Action maintenance changes (#4689)
Adding the local OIDC action in #4688 selects a full website build
because `.gitmodules` is treated as unknown input, while its operator
notes under `scripts/publish/` also select publishing fixtures.
Classify `.gitmodules` changes as CI maintenance only when comparing the
base and HEAD proves that every affected submodule path stays under
`.github/actions/`. Changes to other submodules, invalid or ambiguous
configuration, missing base history, unknown inputs, dependency changes
and explicit full-validation requests keep their existing conservative
behavior.
Exclude top-level publishing Markdown notes from website and
publishing-fixture selection. Executable publishing code and nested
Markdown fixture inputs retain their existing checks. Both
scope-planning entry points use the same classification; the required
Build Check job and workflow security tests remain in place.
Validation:
- All i18n script tests: 420 passed, 1 existing opt-in test skipped, no
failures.
- Regression coverage uses real temporary Git repositories for
additions, removals, URL changes, path moves, malformed metadata,
duplicate definitions and both CLI entry points.
- Replayed the actual five-file diff of #4688: `mode=fixtures`, website
build skipped, publishing/compiler/search fixtures disabled, publication
not allowed.
- `git diff --check` passed.
This is a standalone CI-classification fix and contains no OIDC or
deployment workflow changes.
Co-authored-by: morningman <[email protected]>
---
scripts/i18n/__tests__/ci-maintenance.test.cjs | 126 +++++++++++++++++++++++++
scripts/i18n/build-scope.cjs | 15 ++-
scripts/i18n/ci-maintenance.cjs | 50 ++++++++++
scripts/i18n/ci-plan.cjs | 9 +-
4 files changed, 193 insertions(+), 7 deletions(-)
diff --git a/scripts/i18n/__tests__/ci-maintenance.test.cjs
b/scripts/i18n/__tests__/ci-maintenance.test.cjs
new file mode 100644
index 00000000000..132a11edc4d
--- /dev/null
+++ b/scripts/i18n/__tests__/ci-maintenance.test.cjs
@@ -0,0 +1,126 @@
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const fs = require('node:fs');
+const os = require('node:os');
+const path = require('node:path');
+const {execFileSync} = require('node:child_process');
+const {actionSubmodulesOnly} = require('../ci-maintenance.cjs');
+const {buildScope, validationScope} = require('../build-scope.cjs');
+const {policy, plan} = require('../ci-plan.cjs');
+
+const versions = ['4.x', '3.x'];
+const moduleConfig = (name, target, url =
'https://example.invalid/action.git') =>
+ `[submodule "${name}"]\n\tpath = ${target}\n\turl = ${url}\n`;
+const action = moduleConfig('action', '.github/actions/example');
+const vendor = moduleConfig('vendor', 'vendor/example');
+
+function repository(t, before, after, extra = {}) {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'ci-maintenance-'));
+ t.after(() => fs.rmSync(root, {recursive: true, force: true}));
+ const git = (...args) => execFileSync('git', args, {cwd: root, encoding:
'utf8', stdio: 'pipe'}).trim();
+ const write = (file, content) => {
+ const destination = path.join(root, file);
+ fs.mkdirSync(path.dirname(destination), {recursive: true});
+ if (content === null) fs.rmSync(destination, {force: true});
+ else fs.writeFileSync(destination, content);
+ };
+ const commit = () => {
+ git('add', '.');
+ git('-c', 'user.name=Fixture', '-c',
'[email protected]',
+ '-c', 'commit.gpgsign=false', 'commit', '-qm', 'Fixture');
+ };
+ git('init', '-q');
+ write('.gitignore', '.i18n-build/\n');
+ write('versions.json', JSON.stringify(versions));
+ write('.gitmodules', before);
+ commit();
+ const base = git('rev-parse', 'HEAD');
+ write('.gitmodules', after);
+ for (const [file, content] of Object.entries(extra)) write(file, content);
+ commit();
+ return {root, base, git};
+}
+
+for (const [name, before, after] of [
+ ['add an action', null, action],
+ ['remove an action', action, null],
+ ['change an action URL', action, action.replace('action.git',
'replacement.git')],
+ ['rename an action', action, action.replace('"action"', '"renamed"')],
+ ['keep an unrelated module unchanged', vendor + action, vendor +
action.replace('action.git', 'replacement.git')],
+ ['change only comments', vendor, '# Maintenance comment\n' + vendor],
+]) test(`gitmodules maintenance can ${name}`, t => {
+ const {root, base} = repository(t, before, after);
+ assert.equal(actionSubmodulesOnly(root, base), true);
+ const selected = plan({root, base});
+ assert.equal(selected.mode, 'fixtures');
+ assert.equal(selected.impact.skip_build, true);
+ assert.equal(selected.runPublishFixture, false);
+});
+
+for (const [name, before, after] of [
+ ['add a site module', action, action + vendor],
+ ['remove a site module', vendor + action, action],
+ ['change a site module URL', vendor, vendor.replace('action.git',
'replacement.git')],
+ ['move an action outside CI', action, moduleConfig('action',
'vendor/example')],
+ ['move a site module into CI', vendor, moduleConfig('vendor',
'.github/actions/example')],
+ ['use a path that escapes CI', action, moduleConfig('action',
'.github/actions/../../src/example')],
+ ['omit the module path', action, '[submodule "action"]\nurl =
https://example.invalid/action.git\n'],
+ ['duplicate a module key', action, action + '\tpath =
.github/actions/another\n'],
+ ['duplicate a module path', action, action + moduleConfig('another',
'.github/actions/example')],
+ ['add an unknown configuration section', action, action + '[include]\npath
= other-config\n'],
+ ['contain invalid configuration', action, '[submodule "broken"\n'],
+]) test(`gitmodules changes still require full CI when they ${name}`, t => {
+ const {root, base} = repository(t, before, after);
+ assert.equal(actionSubmodulesOnly(root, base), false);
+ assert.equal(plan({root, base}).mode, 'full');
+});
+
+test('missing base history cannot reduce submodule validation', t => {
+ const {root} = repository(t, null, action);
+ assert.equal(actionSubmodulesOnly(root, '0'.repeat(40)), false);
+ assert.equal(policy(['.gitmodules']).mode, 'full');
+ assert.equal(policy(['.gitmodules'], {forceSample: true}).mode, 'full');
+});
+
+test('top-level publishing notes skip builds while executable code and fixture
inputs retain checks', () => {
+ for (const file of ['scripts/publish/README.md',
'scripts/publish/oss-oidc-probe.md']) {
+ const selected = policy([file]);
+ const scope = buildScope([file], versions);
+ assert.equal(selected.mode, 'fixtures');
+ assert.equal(selected.runPublishFixture, false);
+ assert.equal(scope.skip_build, true);
+ assert.equal(scope.optimize_publish, false);
+ }
+ for (const file of ['scripts/publish/optimize.cjs',
'scripts/publish/__tests__/fixtures/example.md']) {
+ assert.equal(validationScope([file]).check_publish_tests, true);
+ assert.equal(policy([file]).runPublishFixture, true);
+ assert.equal(buildScope([file], versions).optimize_publish, true);
+ }
+});
+
+test('the OIDC-action PR file set selects no website or publishing fixture
build through both CLIs', t => {
+ const fixture = repository(t, action, action + moduleConfig('oidc',
'.github/actions/oidc'), {
+ '.github/workflows/verify-website-oss.yml': 'name: OIDC probe\n',
+ '.github/scripts/test_website_oss_probe.py': '# Workflow boundary
tests\n',
+ 'scripts/publish/oss-oidc-probe.md': '# Operator notes\n',
+ });
+ fixture.git('update-index', '--add', '--cacheinfo',
`160000,${fixture.base},.github/actions/oidc`);
+ fixture.git('-c', 'user.name=Fixture', '-c',
'[email protected]',
+ '-c', 'commit.gpgsign=false', 'commit', '-qm', 'Add pinned action');
+ const selected = plan(fixture);
+ assert.equal(selected.files.length, 5);
+ assert.equal(selected.mode, 'fixtures');
+ assert.equal(selected.impact.skip_build, true);
+ assert.equal(selected.publicationAllowed, false);
+ for (const key of ['runPublishFixture', 'runCompilerFixture',
'runSearchFixture']) assert.equal(selected[key], false);
+ const env = {...process.env, GITHUB_EVENT_PATH: '', GITHUB_OUTPUT: '',
GITHUB_STEP_SUMMARY: ''};
+ const cli = name => JSON.parse(execFileSync(process.execPath,
+ [path.resolve(__dirname, '..', name), fixture.base], {cwd:
fixture.root, env, encoding: 'utf8'}));
+ assert.equal(cli('build-scope.cjs').skip_build, true);
+ assert.equal(cli('ci-plan.cjs').mode, 'fixtures');
+ assert.equal(plan({...fixture, forceFull: true}).mode, 'full');
+ assert.equal(plan({...fixture, event: {pull_request: {labels: [{name:
'ci/full'}]}}}).mode, 'full');
+ for (const file of ['package.json', 'yarn.lock', 'versions.json',
'unknown-input.bin']) {
+ assert.equal(policy([...selected.files, file], {actionSubmodules:
true}).mode, 'full');
+ }
+});
diff --git a/scripts/i18n/build-scope.cjs b/scripts/i18n/build-scope.cjs
index 85870ef8909..6b1f15ba12a 100644
--- a/scripts/i18n/build-scope.cjs
+++ b/scripts/i18n/build-scope.cjs
@@ -3,6 +3,7 @@ const path = require('node:path');
const {execFileSync} = require('node:child_process');
const {locales, localeRegistry} = require('../../config/i18n');
const {managedLocales} = require('./state.cjs');
+const {isPublishMaintenanceNote, actionSubmodulesOnly} =
require('./ci-maintenance.cjs');
// Locales that stay opt-in, so CI has to enable exactly the ones in scope.
const optionalLocales = localeRegistry.filter(locale =>
locale.optional).map(locale => locale.code);
const globalLanguageRuntime = file =>
/^src\/utils\/(locale|localization|translation|localizedRoute|localePreference|contentRoute|useLocalizedRoute|useLanguageItems|languageMessages|englishTranslation|englishLocalization|useEnglishContentContext)\.[jt]sx?$/.test(file)
@@ -15,7 +16,8 @@ const globalLanguageRuntime = file =>
/^src\/utils\/(locale|localization|transla
function validationScope(files) {
const dependencies = files.some(file =>
/^(package.json|yarn.lock)$/.test(file));
const workflow = files.includes('.github/workflows/build-check.yml');
- const publishing = files.some(file =>
/^(scripts\/publish\/|config\/matomo-plugin\/|scripts\/i18n\/locale-entry\.cjs$|scripts\/build-locales\.cjs$|scripts\/build-locale\.cjs$|config\/(?:(custom-docusaurus-plugin|ssrTemplate|asset-origin)\.js|locale-entry\.json)$|static\/\.htaccess$|static\/js\/[^/]*bootstrap\.js$|\.github\/workflows\/(cron|manual)-deploy-website\.yml$)/.test(file));
+ const publishing = files.some(file => !isPublishMaintenanceNote(file)
+ &&
/^(scripts\/publish\/|config\/matomo-plugin\/|scripts\/i18n\/locale-entry\.cjs$|scripts\/build-locales\.cjs$|scripts\/build-locale\.cjs$|config\/(?:(custom-docusaurus-plugin|ssrTemplate|asset-origin)\.js|locale-entry\.json)$|static\/\.htaccess$|static\/js\/[^/]*bootstrap\.js$|\.github\/workflows\/(cron|manual)-deploy-website\.yml$)/.test(file));
const content = files.some(file => globalLanguageRuntime(file)
|| file === 'translations/shared/registry.json'
|| /^scripts\/i18n\/(?!__tests__\/).*\.[cm]?js$/.test(file)
@@ -32,7 +34,7 @@ function validationScope(files) {
// `managed` lists the locales whose content carries translation state. A
change
// to one of their dictionaries or state files needs a real render build, while
// the same change for a source-only locale does not.
-function buildScope(files, versions, managed = [], dependencies = null) {
+function buildScope(files, versions, managed = [], dependencies = null,
{actionSubmodules = false} = {}) {
const active = ['current', ...versions];
const wanted = new Set(), languages = new Set(), json = new Set(), retired
= new Set();
let tier = 'skip';
@@ -40,7 +42,8 @@ function buildScope(files, versions, managed = [],
dependencies = null) {
const shared = () => {locales.forEach(locale => languages.add(locale));
build();};
for (const file of files) {
let match;
- if (['versions.json', 'config/versions-plugin.js'].includes(file))
{tier = 'full'; shared();}
+ if (isPublishMaintenanceNote(file) || file === '.gitmodules' &&
actionSubmodules) {}
+ else if (['versions.json',
'config/versions-plugin.js'].includes(file)) {tier = 'full'; shared();}
else if (file.startsWith('docs/')) {languages.add('en');
wanted.add('current'); build();}
else if ((match = file.match(/^versioned_docs\/version-([^/]+)\//)))
{languages.add('en'); wanted.add(match[1]); build();}
else if ((match = file.match(/^i18n\/([^/]+)\/(.+)$/))) {
@@ -95,7 +98,8 @@ function buildScope(files, versions, managed = [],
dependencies = null) {
|| /^scripts\/i18n\/verify-(doc-navigation|search)\.cjs$/.test(file));
const contractChanged = files.some(file =>
/^scripts\/i18n\/(content-manifest|manual-state|manual-plugins|native-context|docs-plugin|status-plugin|route-context|page-body|page-body-loader|sitemap)\.cjs$/.test(file)
|| (/^translations\/(pages|blog)\//.test(file) &&
!dependencies?.complete));
- const optimizePublish = contractChanged || searchChanged ||
navigationChanged || files.some(file =>
/^(scripts\/publish\/|config\/matomo-plugin\/|scripts\/i18n\/locale-entry\.cjs$|package\.json$|yarn\.lock$|docusaurus\.config\.js$|config\/(?:(i18n|custom-docusaurus-plugin|ssrTemplate|asset-origin)\.js|locale-entry\.json)$|scripts\/build-locales?\.cjs$|static\/\.htaccess$|static\/js\/[^/]*bootstrap\.js$|\.github\/workflows\/(cron-deploy-website|manual-deploy-website|build-check)\.yml$
[...]
+ const optimizePublish = contractChanged || searchChanged ||
navigationChanged || files.some(file => !isPublishMaintenanceNote(file)
+ &&
/^(scripts\/publish\/|config\/matomo-plugin\/|scripts\/i18n\/locale-entry\.cjs$|package\.json$|yarn\.lock$|docusaurus\.config\.js$|config\/(?:(i18n|custom-docusaurus-plugin|ssrTemplate|asset-origin)\.js|locale-entry\.json)$|scripts\/build-locales?\.cjs$|static\/\.htaccess$|static\/js\/[^/]*bootstrap\.js$|\.github\/workflows\/(cron-deploy-website|manual-deploy-website|build-check)\.yml$)/.test(file));
// Publication changes need the same complete artifact as deployment, on
// the CI runner. Keep local checks scoped to fixtures and Dev versions.
if (optimizePublish) {tier = 'full'; shared();}
@@ -120,7 +124,8 @@ if (require.main === module) {
if (!base) throw new Error('Usage: build-scope.cjs <base SHA>');
const files = execFileSync('git', ['diff', '--name-only', base, 'HEAD'],
{encoding:'utf8'}).trim().split('\n').filter(Boolean);
const dependencies = require('./content-impact.cjs').analyzeImpact(root,
base, files);
- const plan = buildScope(files,
JSON.parse(fs.readFileSync(path.join(root,'versions.json'))),
managedLocales(root), dependencies);
+ const actionSubmodules = files.includes('.gitmodules') &&
actionSubmodulesOnly(root, base);
+ const plan = buildScope(files,
JSON.parse(fs.readFileSync(path.join(root,'versions.json'))),
managedLocales(root), dependencies, {actionSubmodules});
for (const file of plan.json) if (fs.existsSync(file))
JSON.parse(fs.readFileSync(file,'utf8'));
const report = JSON.stringify({schemaVersion: 1, sourceSha:
execFileSync('git', ['rev-parse', 'HEAD'], {encoding: 'utf8'}).trim(),
baseSha: base, files, ...plan}, null, 2) + '\n';
diff --git a/scripts/i18n/ci-maintenance.cjs b/scripts/i18n/ci-maintenance.cjs
new file mode 100644
index 00000000000..aed0e7ad62d
--- /dev/null
+++ b/scripts/i18n/ci-maintenance.cjs
@@ -0,0 +1,50 @@
+const {execFileSync} = require('node:child_process');
+
+// Only top-level operator notes are excluded. Markdown used by nested test
+// fixtures can affect publishing behavior and must retain its checks.
+const isPublishMaintenanceNote = file =>
/^scripts\/publish\/[^/]+\.md$/.test(file);
+
+function actionSubmodulesOnly(root, base) {
+ const git = (args, input) => execFileSync('git', args,
+ {cwd: root, input, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'],
maxBuffer: 1024 * 1024});
+ function modules(revision) {
+ const entry = git(['ls-tree', '-z', revision, '--', '.gitmodules']);
+ if (!entry) return new Map();
+ const match = entry.match(/^100(?:644|755) blob
([a-f0-9]{40})\t\.gitmodules\0$/);
+ if (!match) throw new Error('Expected a regular .gitmodules blob');
+ const source = git(['cat-file', 'blob', match[1]]);
+ const config = git(['config', '--null', '--no-includes', '--file',
'-', '--list'], source);
+ const result = new Map();
+ for (const record of config.split('\0').filter(Boolean)) {
+ const separator = record.indexOf('\n');
+ const key = record.slice(0, separator), value =
record.slice(separator + 1);
+ const field = key.match(/^submodule\.(.+)\.([a-z][a-z0-9-]*)$/);
+ if (separator < 0 || !field) throw new Error('Unrecognized
.gitmodules configuration');
+ if (!result.has(field[1])) result.set(field[1], new Map());
+ const attributes = result.get(field[1]);
+ if (attributes.has(field[2])) throw new Error('Ambiguous
.gitmodules configuration');
+ attributes.set(field[2], value);
+ }
+ const paths = [...result.values()].map(attributes =>
attributes.get('path'));
+ if (new Set(paths).size !== paths.length) throw new Error('Duplicate
submodule paths');
+ return result;
+ }
+ const actionPath = value => typeof value === 'string' &&
value.startsWith('.github/actions/')
+ && !value.includes('\\') && value.split('/').every(part => part &&
part !== '.' && part !== '..');
+ const equal = (before, after) => before?.size === after?.size
+ && [...(before ?? [])].every(([key, value]) => after?.get(key) ===
value);
+ try {
+ const before = modules(base), after = modules('HEAD');
+ return [...new Set([...before.keys(), ...after.keys()])].every(name =>
{
+ const previous = before.get(name), current = after.get(name);
+ if (equal(previous, current)) return true;
+ return (!previous || actionPath(previous.get('path')))
+ && (!current || actionPath(current.get('path')));
+ });
+ } catch {
+ // Missing history, invalid syntax and unknown configuration remain
full CI.
+ return false;
+ }
+}
+
+module.exports = {isPublishMaintenanceNote, actionSubmodulesOnly};
diff --git a/scripts/i18n/ci-plan.cjs b/scripts/i18n/ci-plan.cjs
index b405bc1280a..491b8d03496 100644
--- a/scripts/i18n/ci-plan.cjs
+++ b/scripts/i18n/ci-plan.cjs
@@ -8,6 +8,7 @@ const {locales, localeRegistry} = require('../../config/i18n');
const {buildScope, validationScope} = require('./build-scope.cjs');
const {managedLocales} = require('./state.cjs');
const {analyzeImpact} = require('./content-impact.cjs');
+const {actionSubmodulesOnly} = require('./ci-maintenance.cjs');
const mechanism =
/^(src\/utils\/(localizedRoute|localePreference|contentRoute|useLocalizedRoute|useLanguageItems)\.[jt]sx?$|src\/components\/Content(Route|Metadata)\.tsx$|scripts\/i18n\/(content-manifest|manual-state|manual-plugins|native-context|route-context|page-body|page-body-loader|sitemap|content-impact|manual-report|embedded-messages|locale-entry)\.cjs$|static\/js\/[^/]*bootstrap\.js$|static\/\.htaccess$|translations\/(pages|shared)\/registry\.json$|config\/(?:(i18n|ssrTemplate)\
[...]
const runtime =
/^(src\/|config\/|docusaurus\.config\.js$|sidebars[^/]*\.(ts|json)$|versioned_sidebars\/|scripts\/i18n\/(source-revisions|automated-blog|automated-blog-body-loader|release-policy|docs-plugin|status-plugin|state|structure|content-plugin|content-loader|source-groups|code-prose|protection|content-manifest|manual-state|manual-plugins|native-context|route-context|page-body|page-body-loader|sitemap)\.cjs$)/;
@@ -26,12 +27,12 @@ const maintenanceConfig = file => {
return !!match &&
localeRegistry.some(locale=>locale.optional&&locale.code===match[1]);
};
const reportRegistry = 'translations/community-reports.json';
-function policy(files, {forceFull = false, forceSample = false} = {}) {
+function policy(files, {forceFull = false, forceSample = false,
actionSubmodules = false} = {}) {
const risk = files.filter(file => highRisk.test(file));
const changed = files.some(file => content.test(file));
const shared = files.some(file => runtime.test(file) ||
mechanism.test(file) || file === reportRegistry || maintenanceConfig(file));
const checks = validationScope(files);
- const ci = files.some(file => /^(scripts\/|\.github\/)/.test(file));
+ const ci = files.some(file => /^(scripts\/|\.github\/)/.test(file) || file
=== '.gitmodules' && actionSubmodules);
const unknown = files.filter(
file =>
!runtime.test(file) &&
@@ -40,6 +41,7 @@ function policy(files, {forceFull = false, forceSample =
false} = {}) {
file !== reportRegistry &&
!maintenanceConfig(file) &&
!maintenanceNotes.test(file) &&
+ !(file === '.gitmodules' && actionSubmodules) &&
!/^((scripts|\.github|plan-doc|review-docs|\.agents)\/|README\.md$|AGENTS\.md$|LICENSE$|NOTICE$)/.test(
file,
),
@@ -91,7 +93,9 @@ function plan({root, base, event = {}, forceFull = false,
forceSample = false})
.split('\0')
.filter(Boolean);
const labels = event.pull_request?.labels ?? [];
+ const actionSubmodules = files.includes('.gitmodules') &&
actionSubmodulesOnly(root, base);
const selected = policy(files, {
+ actionSubmodules,
forceFull:
forceFull ||
event.inputs?.validation === 'full' ||
@@ -104,6 +108,7 @@ function plan({root, base, event = {}, forceFull = false,
forceSample = false})
JSON.parse(fs.readFileSync(path.join(root, 'versions.json'))),
managedLocales(root),
dependencies,
+ {actionSubmodules},
);
let requested = impact.locales;
if (selected.mode === 'full' || selected.selection === 'representative')
requested = locales;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]