This action is used to launch the Hackbot service and scan a contract for vulnerabilities.
In
.github/workflows/hackbot-scan.yml
:
name: Hackbot Scan Workflow
on:
workflow_dispatch:
jobs:
hackbot-scan:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run Hackbot Scan
uses: GatlingX/hackbot_ci@main
with:
api_key: ${{ secrets.HACKBOT_API_KEY }}
output: "results.json"
artifact: true
generate_issues: false
issues_repo: "YOUR_GITHUB_USERNAME/YOUR_ISSUES_REPO"
id: test-action
- name: Print output
run: |
echo "Hack result: ${{ steps.test-action.outputs.results }}"
The action accepts the following inputs:
Required:
api_key
: Authentication token to use to authenticate with the hackbot service.
Optional:
output
: The output filename to save the results to. Saved results are uploaded as an artifact ifartifact
is true. The result data is json encoded.artifact
: Whether to upload the results as an artifact.generate_issues
: Whether to generate issues with the results. Requires theGITHUB_TOKEN
input to haveissues: write
permissions.issues_repo
: The github repository to generate issues in (username/repo). (required whengenerate_issues
is true).github_token
: The github token to use to authenticate with the github API when generating issues. Both legacy and fine-grained tokens are supported.
Outputs can be accessed in subsequent steps using ${{ steps.test-action.outputs.OUTPUTNAME }}
.
Outputs:
results
: The results of the hack in JSON format.
To use this action in your GitHub workflow, follow these steps:
-
Create a new workflow file (e.g.,
.github/workflows/hackbot-scan.yml
) in your repository. -
Add the following content to the workflow file, adjusting the inputs as needed:
Add the following permissions (e.g. after runs-on):
permissions:
contents: read
issues: write
These permissions are required to read the repository and create issues in the repository. If you don't want to create issues, you can remove the issues: write
permission. NOTE: Failures in the issue generation will not fail the workflow (i.e. the results and artifacts will still be created).
uses: GatlingX/hackbot_ci@main
with:
api_key: ${{ secrets.HACKBOT_API_KEY }}
output: "results.json"
artifact: true
generate_issues: true
issues_repo: "username/repo"
Option api_key
is required and can be found in the Hackbot service settings.
Options output
and artifact
are optional. The output
option instructs the action where to save the results. The artifact
option instructs the action to upload the results as an artifact.
Option generate_issues
is optional. When enabled, the action will create issues in the specified repository.
Option issues_repo
is optional. It is used to specify the repository to create issues in and is required when generate_issues
is true
.
In subsequent steps, the results can be accessed using the results
output or the output
file.
${{ steps.test-action.outputs.results }}"