Skip to content

bradlet/collect-workflow-metrics

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bradlet/collect-workflow-metrics

GitHub Super-Linter CI

seeded from actions/javascript-action

This action gathers metrics about the calling workflow up until this action's step, and makes those metrics available as outputs for subsequent use.

Please open an issue with requests for new metrics to be added!

Supported Metrics

  • Pipeline Runtime
  • Average Leadtime

Contributions

After you've forked and cloned the repository to your local machine or codespace, you'll need to perform some initial setup steps before you can develop your action.

Note

You'll need to have a reasonably modern version of Node.js handy. If you are using a version manager like nvm, you can run nvm use in the root of your repository to install the version specified in .nvmrc. Otherwise, 20.x or later should work!

  1. 🛠️ Install the dependencies

    npm install
  2. 🏗️ Package the JavaScript for distribution

    npm run bundle
  3. ✅ Run the tests

    $ npm test
    
    PASS  ./index.test.js
      ✓ throws invalid number (3ms)
      ✓ wait 500 ms (504ms)
      ✓ test runs (95ms)
    
    ...

Please feel free to open PRs back to the original repository containing any improvements (e.g. new metrics)!

Usage

To include the action in a workflow in another repository, you can use the uses syntax with the @ symbol to reference a specific branch, tag, or commit hash.

steps:
  - name: Checkout
    id: checkout
    uses: actions/checkout@v4

  - name: Collect Workflow Metrics
    id: collect-metrics
    uses: bradlet/collect-workflow-metrics@v1 # or any tag
    with:
      github_token: ${{ secrets.GITHUB_TOKEN }}
      git_head: ${{ github.sha }}
      git_base: main

  - name: Print Output
    id: output
    run: echo "${{ steps.collect-metrics.outputs.workflow_runtime_human }}"

Dependency License Management

This repository includes a GitHub Actions workflow, licensed.yml, that uses Licensed to check for dependencies with missing or non-compliant licenses. This workflow is initially disabled. To enable the workflow, follow the below steps.

  1. Open licensed.yml

  2. Uncomment the following lines:

    # pull_request:
    #   branches:
    #     - main
    # push:
    #   branches:
    #     - main
  3. Save and commit the changes

Once complete, this workflow will run any time a pull request is created or changes pushed directly to main. If the workflow detects any dependencies with missing or non-compliant licenses, it will fail the workflow and provide details on the issue(s) found.

Updating Licenses

Whenever you install or update dependencies, you can use the Licensed CLI to update the licenses database. To install Licensed, see the project's Readme.

To update the cached licenses, run the following command:

licensed cache

To check the status of cached licenses, run the following command:

licensed status

About

A Github Action for gathering metrics about workflow runs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •