Skip to content

smartcontractkit/.github

Repository files navigation

.github

This repository contains reusable Github Actions to be used across our extensive network of repositories.

Using Actions

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>

Action Versions

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:

Automated Updates

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 }}

Contributing

Setup

Dependencies

Post-Install

  • asdf install - will install versions as per the .tool-versions file
  • pnpm install - install all npm dependencies as required
  • pnpm lefthook install - install the git pre-commit hook for formatting
    • pnpm lefthook run pre-commit - to run the pre-commit hook manually

New Actions

  1. Generate the Action boilerplate
    pnpm nx generate nx-chainlink:create-gh-action
  2. Make your changes
  3. Add a changeset for your new action (pnpm changeset)
  4. Commit and open a PR

Existing Actions

  1. Modify the action as needed
  2. Build the action if it is written in JS/TS
  3. Add a changeset (pnpm changeset)
  4. Commit and open a PR

Versioning

Actions are versioned through an automated process managed by changesets. The process is as follows:

  1. You merge a change with a changeset file (in the .changeset directory)
    1. Created through invoking pnpm changeset
  2. A "Version packages" pull request will open or update (ex). This PR will "consume" the changesets present in the default branch by:
    1. Deleting the changeset files
    2. Adding the changeset content to the respective changelogs
    3. Bump the versions in the package.json according to the changeset (patch/minor/major)
  3. The "Version packages" PR gets merged, and the git tags for the actions' versions will be created during CICD.

Example Usage

Below are example "Golden Path" repositories that utilize these reuseable actions.