This repository contains GitHub Actions maintained by the Elastic Organization. Each action lives in its own top-level directory.
Additional actions can be added as new top-level directories.
Actions in this repository are consumed with the standard subdirectory syntax:
uses: elastic/github-actions/<action-name>@<ref>Examples:
steps:
- uses: elastic/github-actions/my-action@v1.0.0steps:
- uses: elastic/github-actions/my-action@abc123def4567890abc123def4567890abc123de # v1.0.0The @<ref> portion is always a repository ref. That means a tag, branch, or SHA points to a
commit in elastic/github-actions, and GitHub then loads the requested action directory from
that commit.
Because refs are repository-wide, action usage looks path-scoped but versioning is commit-scoped. In practice, this means:
elastic/github-actions/my-action@v1.0.0uses themy-action/directory from the repo tagv1.0.0elastic/github-actions/another-action@v3.0.0would use theanother-action/directory from the repo tagv3.0.0- SHA pinning is supported and recommended when consumers want an immutable reference
Different actions in this repository can be referenced at different SHAs if needed:
jobs:
first_job:
runs-on: ubuntu-latest
steps:
- uses: elastic/github-actions/action-one@abc123
second_job:
runs-on: ubuntu-latest
steps:
- uses: elastic/github-actions/action-two@def456The root toolchain uses pnpm (see packageManager in package.json for exact version). Use a Node.js version that matches engines.node, enable Corepack, then install and run scripts from the repository root:
corepack enable
pnpm installRepository scripts in scripts/ are authored in TypeScript and run with tsx. They are covered by the standard root checks:
pnpm typecheckfor script typechecking and editor-friendly TS supportpnpm lintforoxlintpnpm testfor Vitest coveragepnpm buildto executescripts/build-actions.ts
New actions should be created as top-level directories. A minimal example looks like this:
my-action/
action.yml
src/
index.ts
dist/
index.js
licenses.txt
Example action.yml:
name: My Action
description: Example action layout for this repository
runs:
using: node24
main: dist/index.jsExample usage after release:
steps:
- uses: elastic/github-actions/my-action@v1The important part is that dist/ is committed before release so consumers can run the action
directly from the repository ref they pin to. In this repository, dist/ is treated as a generated
artifact:
- Pull requests are reviewed as source changes and must build successfully.
masterauto-updates committeddist/output after merges.- Releases rebuild and fail if a fresh build would change committed output, so release tags always
point to commits with up-to-date
dist/.
CI installs dependencies with pnpm install --frozen-lockfile, so changes that require lockfile
updates must include an updated pnpm-lock.yaml.
The build treats any top-level directory that contains an action.yml as an action and builds it with @vercel/ncc. src/index.ts is the required entrypoint.
Releases are created via the Release workflow with a version like v3.0.0. In addition to creating the vX.Y.Z tag and GitHub release, it force-updates the floating major tag (for example v3).