generated from GatlingX/GatlingGun-Issues
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
79 lines (72 loc) · 2.61 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: "Hackbot CI"
description: "Hackbot workflow action"
author: "GatlingX"
branding:
icon: "check-circle"
color: "red"
inputs:
api_key:
description: "The API key to use to authenticate with the hackbot service"
required: true
output:
description: "The output file to write the results to. It can contain folder paths."
required: false
artifact:
type: boolean
description: "Whether to upload the logs as an artifact"
required: false
default: "false"
generate_issues:
type: boolean
description: "Whether to generate issues with the results"
required: false
default: "false"
issues_repo:
description: 'The repository to generate issues in. It should be in the format of "username/repo"'
required: false
github_token:
description: "The GitHub token to use to authenticate with GitHub, only needed if generate_issues is true"
required: false
address:
description: "The address of the hackbot server"
required: false
default: "https://app.hackbot.org"
port:
description: "The port of the hackbot server"
required: false
default: "443"
outputs:
results:
description: "The results of the hack"
value: ${{ steps.hack_contract.outputs.results }}
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11.9"
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade hackbot
- name: Hack the contract
id: hack_contract
shell: bash
continue-on-error: true
run: |
echo "Running command: python -m hackbot run --api-key '${{ inputs.api_key }}' --source '${{ github.workspace }}' --address '${{ inputs.address }}' --port '${{ inputs.port }}' --output '${{ inputs.output }}' ${{ inputs.generate_issues == 'true' && format('--issues_repo {0} --github_api_key {1}', inputs.issues_repo, inputs.github_token) || '' }}"
python -m hackbot run --api-key '${{ inputs.api_key }}' --source '${{ github.workspace }}' --address '${{ inputs.address }}' --port '${{ inputs.port }}' --output '${{ inputs.output }}' ${{ inputs.generate_issues == 'true' && format('--issues_repo {0} --github_api_key {1}', inputs.issues_repo, inputs.github_token) || '' }}
- name: Move logs
shell: bash
if: inputs.artifact == 'true'
run: |
mkdir hb_logs
mv ${{ inputs.output }} hb_logs/${{ inputs.output }}
- name: Upload logs
if: inputs.artifact == 'true'
uses: actions/upload-artifact@v4
with:
name: hack-logs
path: hb_logs
retention-days: 90