| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Committed GitHub Actions.
This is a mix of Typescript actions, composite actions and Dockerfile actions.
Use the latest branch for the version, unless you want to specific tagged version. For example use commitd/action/name@latest (where name is the directory in which the action is in this repository).
This repository is based on actions/typescript-action which is a basic template and github/codeql-action which illustrates a multi-action repository (though is not a starter template).
We use the following branches:
We have two different build processes:
The tests (npm test) can be considered (manual verified in most case) integration tests. Used the package built artifacts. As such you must build before you test:
npm run package:all npm test
## Deployment
Deployment is automatic by pull request from main to latest. A GitHub Action will build the source (for all actions) and commit the new action code in dist to the latest branch.
It may be wise to tag a version if you are making breaking changes.
Use the v[yy.mm.dd] format for versioning. Hence a semantic release v1, v2, makes little sense as different components will have different breaking changes.
By this means user of the action can refer to the tag commitd/actions/example@v21.02 rather than commitd/actions/example@latest to pin to the version as of Feb 2020.
Creating a new action with Typescript is simple by convention.
We assume the action is called example. Everywhere where example is included below you be replaced with the actual action name.
# TODO: Give a good name and description name: 'Committed Example' description: 'An example github action' author: 'Committed' # TODO You may need inputs and outputs runs: using: 'node12' # TODO: Replace this main: 'dist/example/index.js'
import * as core from "@actions/core"
async function run(): Promise<void> {
try {
// TODO Your code here
} catch (error) {
core.setFailed(error.message)
}
}
run()
test("Run example", () => {
runAsAction("example", {
// TODO: if you have any variables
})
})
name: Test example
# Only run on pull requests and push to main when the
on:
push:
branches:
- main
paths:
- .github/workflows/test-example.yml
- src/example/**.ts
pull_request:
paths:
- .github/workflows/test-example.yml
- src/example/**.ts
env:
ACTION: example
jobs:
test-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: "16"
cache: "npm"
- name: Install
run: npm ci
- name: Build
run: npm run package --action=${env.ACTION}
- name: Test
run: npm test src/${env.ACTION}
# TODO: Before you run your example you might need something to run it on
# e.g. a node project.
# Here you will need to setup that test environment.
- name: Use action
uses: ./${env.ACTION}
# Include any inputs your action needs
# with:
# value: "123"
When you create a PR the test-example.yml will be run.
If you push the built dist directory to a branch, for example cf-example-dist, then you will be able to test your action in other repositories using uses: commitd/actions/example@cf-example-dist.
Composite and Docker action can be created simply:
This can then be pull-requested, etc as with a Typescript action.
You must commit the node_modules directory and all the build artifacts.
This is a multi action repository, the actions are named by directory. Within an action directory there will is a action.yml file. To avoid confusion, limit the number of directories to a minimum!
You can use either branch or tag (or commit) to refer to which action you want. As we have multiple actions, we are versioning everything at once.
debug is only output if you set the secret ACTIONS_RUNNER_DEBUG to true
| Back | FazBrowse Home | New Git URL |