No description
Find a file
Tommy Morgan 96172361d8
feat: add Forgejo compatibility support
- Add symlink from .forgejo/workflows to .github/workflows
- Document Forgejo compatibility in README
- Enable dual-platform support without code duplication
2025-07-27 18:51:16 -05:00
.forgejo feat: add Forgejo compatibility support 2025-07-27 18:51:16 -05:00
.github/workflows feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
.husky feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
hello-world feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
scripts feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
src feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
.biomeignore feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
.gitignore feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
biome.json feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
CLAUDE.md feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
commitlint.config.js feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
package.json feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
pnpm-lock.yaml feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00
README.md feat: add Forgejo compatibility support 2025-07-27 18:51:16 -05:00
tsconfig.json feat: initial commit of TypeScript GitHub Actions template 2025-07-27 18:43:32 -05:00

GitHub Actions TypeScript Template

A modern TypeScript template for building GitHub Actions with minimal bundling and fast builds.

Features

  • 🚀 TypeScript - Type-safe action development
  • 📦 esbuild - Lightning-fast bundling
  • 🧹 Biome - All-in-one linting and formatting
  • 📌 pnpm - Fast, disk space efficient package manager
  • 🎯 ES Modules - Modern JavaScript module system

Quick Start

# Install dependencies
pnpm install

# Build the action
pnpm build

# Run linting
pnpm lint

# Format code
pnpm format

# Type check
pnpm typecheck

Project Structure

.
├── src/                  # TypeScript source files
│   └── hello-world.ts    # Example action implementation
├── hello-world/          # Action directory
│   ├── action.yaml       # Action metadata
│   └── index.js          # Entry point
├── scripts/              # Build scripts
│   └── build.js          # esbuild configuration
└── dist/                 # Compiled output (git ignored)

Creating a New Action

  1. Create your TypeScript file in src/:

    import * as core from '@actions/core';
    
    export async function run(): Promise<void> {
      // Your action logic here
    }
    
  2. Create an action directory with:

    • action.yaml - Action metadata
    • index.js - Entry point that imports from dist
  3. Update scripts/build.js to include your new action

  4. Build and test your action

Testing the Action

The included workflow (.github/workflows/test-hello-world.yml) demonstrates how to test the action:

- name: Test Hello World Action
  uses: ./hello-world
  with:
    name: 'GitHub Actions'

Using in Other Repositories

Once published, use your action in workflows:

- uses: your-username/your-repo@main
  with:
    name: 'World'

Development

This template uses:

  • Node.js 20 - Latest LTS version
  • pnpm 10 - Enabled via Corepack
  • Biome v2 - Fast, modern linting and formatting
  • esbuild - Bundles TypeScript with dependencies

Forgejo Compatibility

This template is compatible with both GitHub Actions and Forgejo Actions:

Setup for Forgejo

  1. The repository includes a symlink from .forgejo/workflows to .github/workflows, so workflows work on both platforms automatically.

  2. Runner Compatibility: The default ubuntu-latest runner works on both platforms. For Forgejo instances that require specific runner configurations, you may need to adjust the runs-on values in workflows.

  3. Action References: Most action references (like actions/checkout@v4) work on both platforms as Forgejo maintains compatibility with common GitHub Actions.

Platform-Specific Considerations

  • Token: Both platforms provide GITHUB_TOKEN for compatibility
  • Context Variables: GitHub context variables (like github.event, github.repository) work on both platforms
  • Secrets: Both platforms support secrets in the same way

Testing on Forgejo

To test these actions on a Forgejo instance:

# Works on both GitHub and Forgejo
- uses: actions/checkout@v4
- uses: ./hello-world
  with:
    name: 'Forgejo'

License

MIT