Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/shellcheck-actions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ SHELLCHECK_OPTS=(

for f in "$DIR"/../**/*.yaml; do
info "Linting scripts in $f"
yq '.runs.steps[].run' "$f" | grep -v -P "^null$" | shellcheck "${SHELLCHECK_OPTS[@]}" -
# Filter out scripts that don't have any shell scripts in them
scripts=$(yq '.runs.steps[].run' "$f" | (grep -v -P "^null$" || true))
if [[ -n "$scripts" ]]; then
echo "$scripts" | shellcheck "${SHELLCHECK_OPTS[@]}" -
fi
done
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ __pycache__/
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
Expand Down Expand Up @@ -165,3 +164,6 @@ docs/.sphinx/.wordlist.dic

# output of contributors script
contributors.html

# PNPM
node_modules/
20 changes: 20 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as esbuild from "esbuild";

const [entryPoint, outfile] = process.argv.slice(2);

if (!entryPoint || !outfile) {
console.error("Usage: node build.mjs <entryPoint> <outfile>");
process.exit(1);
}

await esbuild.build({
entryPoints: [entryPoint],
bundle: true,
platform: "node",
target: "node24",
format: "esm",
outfile,
banner: {
js: "import { createRequire as __require__ } from 'module'; globalThis.require = __require__(import.meta.url);",
},
Comment on lines +17 to +19

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prepends the string to dist/index.js for each built action. The string fixes an issue that's frankly really convoluted and circular and exemplifies the Node ecosystem. TL;DR, there's multiple "kinds" of Node scripts and modern TypeScript is not the same "kind" as the flattened JavaScript we need to output for GitHub Actions, and this is mostly fine but it caused some confusion around the require function and this is the workaround that the internet recommends.

});
20 changes: 20 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @ts-check
import js from "@eslint/js";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";

export default defineConfig([
{
ignores: ["**/dist/**", "**/node_modules/**", "docs/**"],
},
{
files: ["**/*.ts"],
extends: [js.configs.recommended, tseslint.configs.recommended],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
]);
31 changes: 31 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "starflow",
"version": "0.0.1",
"description": "A set of GitHub Actions used by the craft tools and libraries.",
"private": true,
"scripts": {
"build": "pnpm -r run build",
"test": "pnpm -r run test",
"lint": "eslint . && tsc --noEmit"
Comment on lines +7 to +9

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these can be run at the root of the project as pnpm <script>. pnpm -r <action> will find all subdirectories that contain a package.json file and run pnpm <action>. You can also run it for a specific action without cding with, for example, pnpm lint -F secscan.

Actions here are overridden by actions of the same name in subdirectories.

},
"keywords": [],
"author": "",
"license": "GPL-3.0-only",
"devEngines": {
"packageManager": {
"name": "pnpm",
"version": "^11.7.0",
"onFail": "warn"
}
},
"type": "module",
"devDependencies": {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These dependencies are inherited by subdirectories and are common dependencies other actions may want. It's the compiler, the testing framework, and the linter.

"@eslint/js": "^10.0.1",
"@types/node": "^25.9.3",
"esbuild": "^0.28.1",
"eslint": "^10.5.0",
"typescript": "^6.0.3",
"typescript-eslint": "^8.61.1",
"vitest": "^4.1.9"
}
}
Loading
Loading