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!
- Pipeline Runtime
- Average Leadtime
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!
-
🛠️ Install the dependencies
npm install
-
🏗️ Package the JavaScript for distribution
npm run bundle
-
✅ 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)!
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 }}"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.
-
Open
licensed.yml -
Uncomment the following lines:
# pull_request: # branches: # - main # push: # branches: # - main
-
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.
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 cacheTo check the status of cached licenses, run the following command:
licensed status