FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fully migrate `pr-checks` to ESM by mbg · Pull Request #4200 · github/codeql-action · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .json  (3) .mjs  (1) .ts  (15) .yml  (1) dotfile  (1) All 5 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions .github/workflows/pr-checks.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ jobs:
working-directory: pr-checks
run: npx tsx --test

- name: Run `pr-checks/changenotes.mts` to ensure that all unreleased change notes are valid
- name: Run `pr-checks/changenotes.ts` to ensure that all unreleased change notes are valid
if: ${{ !cancelled() && steps.install-deps.outcome == 'success' }}
run: npx tsx pr-checks/changenotes.mts validate
run: npx tsx pr-checks/changenotes.ts validate

- name: Verify all Actions use the same Node version
id: head-version
Expand Down
4 changes: 2 additions & 2 deletions eslint.config.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export default [
},
},
{
files: ["**/*.ts", "**/*.js", "**/*.mts"],
files: ["**/*.ts", "**/*.js"],

rules: {
"@typescript-eslint/no-explicit-any": "off",
Expand All @@ -180,7 +180,7 @@ export default [
},
},
{
files: ["pr-checks/**/*.ts", "pr-checks/**/*.mts"],
files: ["pr-checks/**/*.ts"],

languageOptions: {
parserOptions: {
Expand Down
19 changes: 18 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pr-checks/.nvmrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
2 changes: 1 addition & 1 deletion pr-checks/bundle-changelog.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ function main() {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
process.exit(main());
}
2 changes: 1 addition & 1 deletion pr-checks/bundle-metadata.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ async function main() {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
void main();
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
isValidChangenoteFile,
isValidChangenoteFilename,
VALID_CHANGE_NOTE_CATEGORIES,
} from "./validate.mjs";
} from "./validate";

await describe("isValidChangenoteContent", async () => {
await it("recognizes an unordered Markdown list", () => {
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
renderChangelog,
withChangelog,
} from "./changelog";
import { isValidChangenoteFile } from "./changelog/validate.mjs";
import { isValidChangenoteFile } from "./changelog/validate";
import { CHANGENOTES_DIR } from "./config";

/**
Expand Down Expand Up @@ -82,9 +82,9 @@ function main(): ExitCode {

function usage(): ExitCode {
const message =
"Usage: changenotes.mts assemble\n" +
" changenotes.mts validate\n" +
" changenotes.mts help";
"Usage: changenotes.ts assemble\n" +
" changenotes.ts validate\n" +
" changenotes.ts help";
console.log(message);
return ExitCode.Success;
}
Expand Down
2 changes: 1 addition & 1 deletion pr-checks/check-repo-size.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,6 @@ async function run(): Promise<void> {
}
}

if (require.main === module) {
if (import.meta.main) {
void run();
}
5 changes: 5 additions & 0 deletions pr-checks/config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import path from "path";
import { fileURLToPath } from "url";

// For backwards-compatibility.
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

/** The oldest supported major version of the CodeQL Action. */
export const OLDEST_SUPPORTED_MAJOR_VERSION = 3;
Expand Down
3 changes: 2 additions & 1 deletion pr-checks/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"private": true,
"description": "Dependencies for codeql-action scripts",
"type": "module",
"dependencies": {
"@actions/core": "^2.0.3",
"@actions/github": "^8.0.1",
Expand All @@ -13,7 +14,7 @@
"yaml": "^2.9.1"
},
"devDependencies": {
"@types/node": "^20.19.43",
"@types/node": "^24.19.0",
"tsx": "^4.23.15"
}
}
2 changes: 1 addition & 1 deletion pr-checks/prepare-changelog.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ function main() {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
process.exit(main());
}
2 changes: 1 addition & 1 deletion pr-checks/release-branches.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,6 @@ async function main() {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
void main();
}
2 changes: 1 addition & 1 deletion pr-checks/rollback-changelog.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ function main() {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
process.exit(main());
}
11 changes: 6 additions & 5 deletions pr-checks/sync-back.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import * as fs from "fs";
import { parseArgs } from "node:util";
import * as path from "path";

const THIS_DIR = __dirname;
const CHECKS_DIR = path.join(THIS_DIR, "checks");
const WORKFLOW_DIR = path.join(THIS_DIR, "..", ".github", "workflows");
const SYNC_TS_PATH = path.join(THIS_DIR, "sync.ts");
import { PR_CHECKS_DIR, REPO_ROOT } from "./config";

const CHECKS_DIR = path.join(PR_CHECKS_DIR, "checks");
const WORKFLOW_DIR = path.join(REPO_ROOT, ".github", "workflows");
const SYNC_TS_PATH = path.join(PR_CHECKS_DIR, "sync.ts");

/**
* Scan generated workflow files to extract the latest action versions.
Expand Down Expand Up @@ -232,6 +233,6 @@ function main(): number {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
process.exit(main());
}
2 changes: 1 addition & 1 deletion pr-checks/sync-checks.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,6 @@ async function main(): Promise<void> {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
void main();
}
7 changes: 4 additions & 3 deletions pr-checks/sync.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as yaml from "yaml";

import { BuiltInLanguage } from "../src/languages";

import { PR_CHECKS_DIR, REPO_ROOT } from "./config";

/**
* Returns a `uses` value for `action` pinned to a commit SHA, with the
* human-readable version recorded in a trailing comment.
Expand Down Expand Up @@ -312,9 +314,8 @@ const languageSetups: LanguageSetups = {
// See https://github.com/github/codeql-action/pull/3423
const YQ_VERSION = "v4.50.1";

const THIS_DIR = __dirname;
const CHECKS_DIR = path.join(THIS_DIR, "checks");
const OUTPUT_DIR = path.join(THIS_DIR, "..", ".github", "workflows");
const CHECKS_DIR = path.join(PR_CHECKS_DIR, "checks");
const OUTPUT_DIR = path.join(REPO_ROOT, ".github", "workflows");

/**
* Loads and parses a YAML file.
Expand Down
2 changes: 1 addition & 1 deletion pr-checks/tsconfig.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"sourceMap": false,
"noEmit": true
},
"include": ["./**/*.ts", "./**/*.mts", "../src/**/*.ts"],
"include": ["./**/*.ts", "../src/**/*.ts"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion pr-checks/update-ghes-versions.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,6 @@ function main() {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
main();
}
2 changes: 1 addition & 1 deletion pr-checks/update-release-branch.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,6 @@ async function main(): Promise<void> {
}

// Only call `main` if this script was run directly.
if (require.main === module) {
if (import.meta.main) {
void main();
}
Loading

Back | FazBrowse Home | New Git URL