This repository contains reusable Github Actions to be used across our extensive network of repositories.
To use the actions in this repo you should will place the action reference in
the uses
field of a Job step
(docs).
- uses: smartcontractkit/.github/actions/<action>@<commit> # <action>@<version>
This is a monorepo and all actions are versioned and tagged with the format
<action>@<version>
. To find the available versions, and corresponding commit
for an action:
- Look at the repo's tags through Github UI: https://github.com/smartcontractkit/.github/tags
- Query the tags through CLI
git for-each-ref --format="%(objectname) %(refname:short)" refs/tags | grep "<action name>"
Updating these actions automatically requires a custom workflow, as Dependabot doesn't support updates for actions contained in monorepos.
Example Workflow
name: Update Actions
on:
schedule:
- cron: "0 0 * * *"
jobs:
update-actions:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- name: Update custom actions
uses: smartcontractkit/.github/actions/update-actions@5f5ebd52cb13f4b8530cd3005ec7ec3180840219 # update-actions@0.1.5
with:
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN_GATI }}
aws-lambda-url: ${{ secrets.AWS_LAMBDA_URL_GATI }}
aws-role-arn-updater: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN_GATI_UPDATER }}
aws-lambda-url-updater: ${{ secrets.AWS_LAMBDA_URL_GATI_UPDATER }}
aws-region: ${{ secrets.AWS_REGION }}
asdf install
- will install versions as per the.tool-versions
filepnpm install
- install all npm dependencies as requiredpnpm lefthook install
- install the git pre-commit hook for formattingpnpm lefthook run pre-commit
- to run the pre-commit hook manually
- Generate the Action boilerplate
pnpm nx generate nx-chainlink:create-gh-action
- Make your changes
- Add a changeset for your new action (
pnpm changeset
) - Commit and open a PR
- Modify the action as needed
- Build the action if it is written in JS/TS
- Add a changeset (
pnpm changeset
) - Commit and open a PR
Actions are versioned through an automated process managed by
changesets
. The process is as
follows:
- You merge a change with a changeset file (in the
.changeset
directory)- Created through invoking
pnpm changeset
- Created through invoking
- A "Version packages" pull request will open or update
(ex). This PR will
"consume" the changesets present in the default branch by:
- Deleting the changeset files
- Adding the changeset content to the respective changelogs
- Bump the versions in the
package.json
according to the changeset (patch/minor/major)
- The "Version packages" PR gets merged, and the git tags for the actions' versions will be created during CICD.
Below are example "Golden Path" repositories that utilize these reuseable actions.
- Go application:
smartcontractkit/releng-go-app
- Go library:
smartcontractkit/releng-go-lib
- TypeScript application:
smartcontractkit/releng-ts-app
- Solidity contracts:
smartcontractkit/releng-sol-contracts