A library or collection of AST github shared composite actions.
The repository uses a pre-commit hook to run linting on all TypeScript projects.
This runs automatically when installing dependencies in the root directory of the actions.
When adding a new action, update .githooks/pre-commit
to include your project:
The pre-commit hook:
- Builds TypeScript files
- Stages compiled dist files
- Runs linting
.github/workflows/linting.yml
runs on PR creation and updates:
- Runs ESLint on all TypeScript files
- Executes in parallel for each project
- Fails if linting errors are found
.github/workflows/building.yml
ensures compiled code matches source:
- Cleans and rebuilds TypeScript
- Compares with committed build artifacts
- Fails if builds are out of sync
When creating a new shared GitHub Action:
- Create a new directory for your action:
mkdir my-new-action
cd my-new-action
- Initialize the project:
bun init
- Add to GitHub workflows by updating the matrix in both workflow files:
strategy:
matrix:
project: ['upstream-tag-on-merge', 'upstream-tag-sync', 'my-new-action']
- Add to
.githooks/pre-commit
:
for project in upstream-tag-on-merge upstream-tag-sync my-new-action; do
# ...
done
- Required scripts:
package.json
scripts:
{
"scripts": {
"build": "bun install && bun build src/index.ts --outdir=dist --target=node --entry-naming '[name].mjs'",
"lint": "eslint . \"**/*.ts\"",
"prepare": "git config core.hooksPath .githooks"
}
}
Follow github best practice: https://docs.github.com/en/actions/sharing-automations/creating-actions/about-custom-actions#using-tags-for-release-management