Package Exports
- ghat
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ghat) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ghat
Reuse GitHub Action workflows across repositories
Stop maintaining a separate workflow for every one of your repository, use ghat to sync them with your favorite version.
You can run ghat once to set up your workflow in a new repo or run it every time you want to update it. Updating existing workflows will override any changes except for the global env object, which will be merged with the templates’s existing env object.
Note: ghat is a tool that runs on your computer, not on GitHub Actions, and requires you to commit the changes, so you can be sure that the workflow never changes without you agreeing to it.
Usage
This repository has a few templates you can use, but ghat can fetch any repository or specific file within it — exactly like degit can, the tool ghat is based on.
You can refer to degit’s documentation to find out what other source formats are allowed (including specifying branches, commits and other references).
$ ghat --help
Usage
$ ghat <source>
Examples
$ ghat fregante/ghat/templates/node
$ ghat fregante/ghat/templates/node --exclude jobs.Build --exclude jobs.Test
Options:
--exclude <dot.notation.object> Any part of the YAML file to be removed (can be repeated)Fetch repo
If you provide a user/repo address, ghat will fetch the repository and look for *.yml files at the top level. If none are found, it will assume you want to copy the repo’s active workflows from .github/workflows
npx ghat fregante/ghat
# Copies *.ya?ml OR .github/workflows/*.ya?mlFetch whole folder
npx ghat fregante/ghat/templates/node
# Copies templates/node/*.ya?ml into .github/workflows. It's NOT recursiveFetch specific file
npx ghat fregante/ghat/templates/node/ci.yml
# Copies templates/node/ci.yml into .github/workflows/ci.ymlCustomization
Exclude properties
You can exclude any property from the template by using the --exclude flag multiple times. This will delete each of the specified values dot notations.
env object
When you fetch a workflow that already exists locally, the local file will be overridden, except for the top-level env object. For example:
Local file
env:
ADJECTIVE: cool
# Generated by `npx ghat fregante/workflows/demo`
# DO NOT EDIT BELOW
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo My workflow is $ADJECTIVETemplate file
env:
ADJECTIVE: the default
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo This new workflow is "$ADJECTIVE" since it was updatedUpdated local file
Only the top-level env will be preserved, the rest will be updated.
env:
ADJECTIVE: cool
# Generated by `npx ghat fregante/workflows/demo`
# DO NOT EDIT BELOW
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo This new workflow is "$ADJECTIVE" since it was updatedLicense
MIT © Federico Brigante