mirror of
https://github.com/tree-sitter/tree-sitter.git
synced 2026-09-12 16:36:27 -04:00
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
module.exports = async ({ github, context, core }) => {
|
|
if (context.eventName !== 'pull_request') return;
|
|
|
|
const prNumber = context.payload.pull_request.number;
|
|
const owner = context.repo.owner;
|
|
const repo = context.repo.repo;
|
|
|
|
const files = await github.paginate(github.rest.pulls.listFiles, {
|
|
owner,
|
|
repo,
|
|
pull_number: prNumber,
|
|
per_page: 100
|
|
});
|
|
|
|
const changedFiles = files.map(file => file.filename);
|
|
|
|
const wasmStdLibSources = [
|
|
'lib/src/wasm-stdlib/external_scanner_allocator.c',
|
|
'lib/src/wasm-stdlib/imports.txt',
|
|
'lib/src/wasm-stdlib/libc.c'
|
|
];
|
|
const dirChanged = changedFiles.some(file =>
|
|
wasmStdLibSources.includes(file) ||
|
|
file.startsWith('lib/src/wasm-stdlib/libc/ctype/') ||
|
|
file.startsWith('lib/src/wasm-stdlib/libc/string/')
|
|
);
|
|
|
|
if (!dirChanged) return;
|
|
|
|
const wasmStdLibHeader = 'lib/src/wasm-stdlib/external_scanner_stdlib.h';
|
|
const requiredChanged = changedFiles.includes(wasmStdLibHeader);
|
|
|
|
if (!requiredChanged) core.setFailed(`Changes detected in the Wasm stdlib sources but ${wasmStdLibHeader} was not modified.`);
|
|
};
|