Skip to content

Commit 6a3d0ed

Browse files
codeant-ci-scan
0 parents  commit 6a3d0ed

File tree

3 files changed

+253
-0
lines changed

3 files changed

+253
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 CodeAnt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# CodeAnt CI Scan Action
2+
3+
A GitHub Action to run CodeAnt CI security and code quality analysis on your repository.
4+
5+
## Features
6+
7+
- 🛡️ Automated security and code quality scanning
8+
- 🔍 Deep code analysis and vulnerability detection
9+
- 📊 Detailed reports and insights
10+
- ⚡ Fast and easy integration
11+
12+
## Usage
13+
14+
### Basic Usage
15+
16+
Add this action to your workflow:
17+
18+
```yaml
19+
name: CodeAnt CI Scan
20+
21+
on:
22+
push:
23+
branches: [ "main" ]
24+
pull_request:
25+
branches: [ "main" ]
26+
27+
jobs:
28+
codeant_scan:
29+
name: Run CodeAnt CI scan
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v3
34+
35+
- name: Run CodeAnt CI Scan
36+
uses: CodeAnt-AI/codeant-ci-scan-action@v0.0.1
37+
with:
38+
access_token: ${{ secrets.CODEANT_ACCESS_TOKEN }}
39+
```
40+
41+
### Advanced Usage
42+
43+
Customize the scan with additional options:
44+
45+
```yaml
46+
- name: Run CodeAnt CI Scan
47+
uses: CodeAnt-AI/codeant-ci-scan-action@v0.0.1
48+
with:
49+
access_token: ${{ secrets.CODEANT_ACCESS_TOKEN }}
50+
api_base: 'https://api.codeant.ai'
51+
include_paths: 'src/,lib/'
52+
exclude_paths: 'test/,docs/'
53+
```
54+
55+
## Inputs
56+
57+
| Input | Description | Required | Default |
58+
|-------|-------------|----------|---------|
59+
| `access_token` | CodeAnt access token (PAT or repository token) | Yes | - |
60+
| `api_base` | CodeAnt API base URL | No | `https://api.codeant.ai` |
61+
| `include_paths` | Comma-separated paths to include in scan | No | `''` (all files) |
62+
| `exclude_paths` | Comma-separated paths to exclude from scan | No | `''` (none) |
63+
64+
## Setup
65+
66+
### 1. Get Your CodeAnt Access Token
67+
68+
1. Sign up or log in to [CodeAnt](https://codeant.ai)
69+
2. Navigate to your account settings
70+
3. Generate a new access token
71+
4. Copy the token
72+
73+
### 2. Add Token to GitHub Secrets
74+
75+
1. Go to your repository's Settings
76+
2. Navigate to Secrets and variables → Actions
77+
3. Click "New repository secret"
78+
4. Name: `CODEANT_ACCESS_TOKEN`
79+
5. Value: Paste your CodeAnt access token
80+
6. Click "Add secret"
81+
82+
### 3. Create Workflow File
83+
84+
Create `.github/workflows/codeant-scan.yml` in your repository with the usage example above.
85+
86+
## Supported Events
87+
88+
This action works with any GitHub event that provides commit information:
89+
90+
- `push`
91+
- `pull_request`
92+
- `workflow_dispatch`
93+
- `schedule`
94+
95+
## Example Workflows
96+
97+
### Scan on Push and Pull Request
98+
99+
```yaml
100+
name: CodeAnt CI Scan
101+
102+
on:
103+
push:
104+
branches: [ "main", "develop" ]
105+
pull_request:
106+
branches: [ "main" ]
107+
108+
jobs:
109+
codeant_scan:
110+
runs-on: ubuntu-latest
111+
steps:
112+
- uses: actions/checkout@v3
113+
- uses: CodeAnt-AI/codeant-ci-scan-action@v0.0.1
114+
with:
115+
access_token: ${{ secrets.CODEANT_ACCESS_TOKEN }}
116+
```
117+
118+
### Scheduled Daily Scan
119+
120+
```yaml
121+
name: Daily CodeAnt Scan
122+
123+
on:
124+
schedule:
125+
- cron: '0 2 * * *' # Run at 2 AM UTC daily
126+
127+
jobs:
128+
codeant_scan:
129+
runs-on: ubuntu-latest
130+
steps:
131+
- uses: actions/checkout@v3
132+
- uses: CodeAnt-AI/codeant-ci-scan-action@v0.0.1
133+
with:
134+
access_token: ${{ secrets.CODEANT_ACCESS_TOKEN }}
135+
```
136+
137+
### Scan Specific Directories
138+
139+
```yaml
140+
- uses: CodeAnt-AI/codeant-ci-scan-action@v0.0.1
141+
with:
142+
access_token: ${{ secrets.CODEANT_ACCESS_TOKEN }}
143+
include_paths: 'src/,backend/'
144+
exclude_paths: 'src/tests/,backend/vendor/'
145+
```
146+
147+
## Troubleshooting
148+
149+
### Authentication Errors
150+
151+
- Ensure your `CODEANT_ACCESS_TOKEN` is correctly set in repository secrets
152+
- Verify the token hasn't expired
153+
- Check that the token has the necessary permissions
154+
155+
### Scan Failures
156+
157+
- Verify your repository is accessible
158+
- Check that the API base URL is correct
159+
- Review the action logs for specific error messages
160+
161+
## Support
162+
163+
- 📧 Email: support@codeant.ai
164+
- 📚 Documentation: [https://docs.codeant.ai](https://docs.codeant.ai)
165+
- 🐛 Issues: [GitHub Issues](https://github.com/CodeAnt-AI/codeant-ci-scan-action/issues)
166+
167+
## License
168+
169+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
170+
171+
## About CodeAnt
172+
173+
CodeAnt provides automated code analysis and security scanning to help developers build secure, high-quality software. Visit [codeant.ai](https://codeant.ai) to learn more.

action.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 'CodeAnt CI Scan'
2+
description: 'Run CodeAnt CI security and code quality analysis on your repository'
3+
author: 'CodeAnt'
4+
branding:
5+
icon: 'shield'
6+
color: 'blue'
7+
8+
inputs:
9+
access_token:
10+
description: 'CodeAnt access token (PAT or repository token)'
11+
required: true
12+
api_base:
13+
description: 'CodeAnt API base URL'
14+
required: false
15+
default: 'https://api.codeant.ai'
16+
include_paths:
17+
description: 'Comma-separated paths to include in scan'
18+
required: false
19+
default: ''
20+
exclude_paths:
21+
description: 'Comma-separated paths to exclude from scan'
22+
required: false
23+
default: ''
24+
25+
runs:
26+
using: 'composite'
27+
steps:
28+
- name: Fetch CodeAnt scan script
29+
shell: bash
30+
env:
31+
API_BASE: ${{ inputs.api_base }}
32+
run: |
33+
curl -sS -X GET "${API_BASE}/analysis/ci/scan/script/get" \
34+
--output start_scan.sh.b64
35+
36+
- name: Make script executable
37+
shell: bash
38+
run: |
39+
base64 -d start_scan.sh.b64 > start_scan.sh
40+
chmod +x start_scan.sh
41+
42+
- name: Trigger CodeAnt analysis
43+
shell: bash
44+
env:
45+
ACCESS_TOKEN: ${{ inputs.access_token }}
46+
REPO_NAME: ${{ github.repository }}
47+
COMMIT_ID: ${{ github.sha }}
48+
BRANCH: ${{ github.ref_name }}
49+
INCLUDE_PATHS: ${{ inputs.include_paths }}
50+
EXCLUDE_PATHS: ${{ inputs.exclude_paths }}
51+
run: |
52+
bash start_scan.sh \
53+
-a "$ACCESS_TOKEN" \
54+
-r "$REPO_NAME" \
55+
-c "$COMMIT_ID" \
56+
-b "$BRANCH" \
57+
-s github \
58+
-i "$INCLUDE_PATHS" \
59+
-e "$EXCLUDE_PATHS"

0 commit comments

Comments
 (0)