https://github.com/crytic/slither-docs-action
Write documentation for your code in pull requests using Slither and OpenAI.
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.3%) to scientific vocabulary
Repository
Write documentation for your code in pull requests using Slither and OpenAI.
Basic Info
Statistics
- Stars: 35
- Watchers: 1
- Forks: 3
- Open Issues: 7
- Releases: 1
Metadata Files
README.md
Document with Slither
Documenting your code can be tiresome. This action will help you write
documentation for your code in pull requests using Slither and OpenAI. Just
label your PR with generate-docs and the action will get it done!
You can see an example repository integrating this action here: crytic/slither-docs-demo. An example pull request showing the workflow in action is also available on that repository.
Note
As this action pushes the documentation to the same pull request branch, it only works on pull requests from the same repository. If you trigger the workflow on a pull request originating from a fork, it will display an error.
Usage
This action needs to be run on a pull_request event of type labeled. The
workflow needs to have contents: write permissions (to push documentation
commits to your PR) and pull-requests: write permissions (to untag and leave
comments on your PR)
You will also need an OpenAI API key. You can create one in the OpenAI website, by clicking on your profile picture, followed by the "View API keys" link.
Warning
This action will transmit code from your repository to OpenAI during normal operation. Review OpenAI's terms of service and privacy policy to see how your data will be processed, used, or stored.
Once you have acquired your API key, store it as an Actions secret for the GitHub repository. You may follow the instructions in the GitHub documentation to do so.
Warning
The OpenAI API is a paid service. The requests that Slither performs to OpenAI's API endpoints cost money. Make sure you trust all the contributors with access to your repository, which may invoke this action with your API key. Configure adequate cost limits and alerts in OpenAI to avoid unexpected bills.
yaml
- name: Document with Slither
uses: crytic/slither-docs-action@v0
with:
target: project
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
Options
| Key | Description
|------------------|------------
| target | The path to the root of the project to be documented by Slither. It can be a directory or a file, and it defaults to the repo root.
| openai-api-key | The OpenAI API key.
| trigger-label | The label used to trigger the action. generate-docs by default.
| slither-version| The version of slither-analyzer to use. By default, the latest release in PyPI is used.
| solc-version | The version of solc to use. This only has an effect if you are not using a compilation framework for your project -- i.e., if target is a standalone .sol file.
| github-token | GitHub token, used to compute PR differences and push documentation. By default, it will use the workflow token, and there should be no need to override it.
Examples
These examples assume you have a valid OpenAI API key stored as a secret named
OPENAI_API_KEY in your GitHub repository.
Example: Hardhat
```yaml name: Document with Slither
on: pull_request: types: [labeled] branches: [main]
jobs: document: name: Document with Slither runs-on: ubuntu-latest if: contains(github.event.pull_request.labels.*.name, 'generate-docs') permissions: contents: write pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
working-directory: project
run: npm ci
- name: Document with Slither
uses: crytic/slither-docs-action@v0
with:
target: project
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
```
Example: Foundry
```yaml name: Document with Slither
on: pull_request: types: [labeled] branches: [main]
jobs: document: name: Document with Slither runs-on: ubuntu-latest if: contains(github.event.pull_request.labels.*.name, 'generate-docs') permissions: contents: write pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Document with Slither
uses: crytic/slither-docs-action@v0
with:
target: project
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
```
Owner
- Name: Crytic
- Login: crytic
- Kind: organization
- Email: opensource@trailofbits.com
- Location: New York, NY
- Website: https://www.trailofbits.com/
- Repositories: 66
- Profile: https://github.com/crytic
Blockchain Security, by @trailofbits
GitHub Events
Total
Last Year
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 0
- Total pull requests: 149
- Average time to close issues: N/A
- Average time to close pull requests: 10 days
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.6
- Merged pull requests: 48
- Bot issues: 0
- Bot pull requests: 149
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 7 days
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.5
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 2
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (66)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 1
github actions: crytic/slither-docs-action
Generates documentation for your smart contracts using Slither and OpenAI
- License: other
- Status: removed
-
Latest release: v0.1.0
published over 3 years ago
Rankings
Dependencies
- actions/checkout v3 composite
- actions/setup-node v3.6.0 composite
- actions/upload-artifact v3 composite
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
- ./ * composite
- actions/checkout v3 composite
- dist/index.js node16 javascript
- 505 dependencies
- @types/node ^18.16.3 development
- @types/uuid ^9.0.1 development
- @typescript-eslint/parser ^5.59.6 development
- @vercel/ncc ^0.36.1 development
- eslint ^8.40.0 development
- eslint-plugin-github ^4.7.0 development
- eslint-plugin-jest ^27.2.1 development
- jest ^29.5.0 development
- js-yaml ^4.1.0 development
- prettier 2.8.8 development
- ts-jest ^29.1.0 development
- typescript ^5.0.4 development
- @actions/core ^1.10.0
- @actions/exec ^1.1.1
- @actions/github ^5.1.1
- @actions/io ^1.1.3
- uuid ^9.0.0