Reusable Workflows and Custom Actions
Calling a reusable workflow
jobs:
deploy:
uses: my-org/.github/.github/workflows/deploy.yml@main
with:
environment: production
secrets: inherit
Creating a reusable workflow
In .github/workflows/deploy.yml:
on:
workflow_call:
inputs:
environment:
required: true
type: string
secrets:
DEPLOY_TOKEN:
required: true
Creating a custom Action
In action.yml:
name: 'My Custom Action'
description: 'Does something useful'
inputs:
api-key:
description: 'API key'
required: true
runs:
using: 'node20'
main: 'dist/index.js'
Build with @actions/core and @actions/github packages.