Skip to content

devops-infra/template-action

πŸš€ GitHub Action template

Template repository for GitHub Actions

πŸ“¦ Available on

✨ Features

πŸ“Š Badges

GitHub repo GitHub code size in bytes GitHub last commit GitHub license
DockerHub Docker version Image size Docker Pulls

πŸ“– API Reference

    - name: Run the Action
      uses: devops-infra/template-action@v1
      env:
        barfoo: foobaz
      with:
        foobar: bazbar
        debug: 'false'
        # github_token: ${{ secrets.GITHUB_TOKEN }}

πŸ”¨ Input Variables

Variable Description
barfoo Sample environment variable.

πŸ”§ Input Paremeters

Input Required Default Description
foobar No foobar Sample input used by the action.
debug No false Enable verbose debug logging.
github_token No For authenticated GitHub requests.

πŸ“€ Outputs Parameters

Output Description
foobar Echo of provided foobar input.
barfoo Duplicate of foobar for demo use.

πŸ’» Usage Examples

πŸ“ Basic

Run the Action with defaults.

name: Run the Action on each commit
on: [push]
jobs:
  template-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: devops-infra/template-action@v1

πŸ”€ Advanced

Run the Action with set inputs.

name: Run the Action on each commit
on: [push]
jobs:
  template-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: devops-infra/template-action@v1
        with:
          foobar: hello
          debug: 'true'

🎯 Use specific version

Run the Action with a specific version tag.

name: Run the Action on each commit
on: [push]
jobs:
  template-action:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5

      - uses: devops-infra/[email protected]
        id: Pin patch version

      - uses: devops-infra/[email protected]
        id: Pin minor version

      - uses: devops-infra/template-action@v1
        id: Pin major version

πŸ—οΈ CI/CD

Workflows included:

  • Pull Request: lint (hadolint, shellcheck, actionlint, yamllint), build and push a test image (test-), and a self-test running this action from source.
  • Release (manual): updates action.yml (pins exact vX.Y.Z) and docs (major vX), creates vX.Y.Z and updates vX, vX.Y tags, builds and pushes multi-arch images, and publishes a GitHub Release.
  • Weekly: builds and pushes a test image from the latest release tag (test-) to keep registries active and catch dependency issues.

πŸ§‘β€πŸ’» Development

Prerequisites:

  • Docker with Buildx,
  • Task (installed via workflow or from https://taskfile.dev),
  • gnu-sed if on macOS (brew install gnu-sed),
  • pre-commit (optional).

Common tasks:

# Run all linters
task lint

# Build multi-arch images locally (no push)
task docker:build

# Push images (requires DOCKER_TOKEN and GITHUB_TOKEN)
DOCKER_TOKEN=... GITHUB_TOKEN=... task docker:push

Pre-commit hooks:

pipx install pre-commit  # or pip install --user pre-commit
pre-commit install
pre-commit run --all-files

🏷️ Version Tags: vX, vX.Y, vX.Y.Z

This action supports three tag levels for flexible versioning:

  • vX: latest patch of the major version (e.g., v1).
  • vX.Y: latest patch of the minor version (e.g., v1.2).
  • vX.Y.Z: fixed to a specific release.

🀝 Contributing

Contributions are welcome! See CONTRIBUTING. This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“„ License

MIT β€” see LICENSE.

πŸ’¬ Support

If you have any questions or need help, please:

  • Create an issue
  • Star this repository if you find it useful!