Skip to content

Commit 04da166

Browse files
Updated workflows, security info, README
1 parent 0ddb70a commit 04da166

File tree

7 files changed

+88
-9
lines changed

7 files changed

+88
-9
lines changed

.github/workflows/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
This directory contains GitHub Actions workflow configurations for continuous integration (CI) of the ContextGem project.
44

5+
56
## Available Workflows
67

78
### tests (`ci-tests.yml`)
@@ -22,6 +23,33 @@ This directory contains GitHub Actions workflow configurations for continuous in
2223
- `CONTEXTGEM_OPENAI_API_KEY`: Secret OpenAI API key
2324
- `GIST_SECRET`: Secret token to upload coverage results to a gist for badge generation
2425

26+
### CodeQL Analysis (`codeql.yml`)
27+
28+
This workflow performs code security scanning using GitHub's CodeQL analysis engine.
29+
30+
**Features:**
31+
- Scans Python codebase for security vulnerabilities and coding errors
32+
- Analyzes code quality and identifies potential issues
33+
- Results are available in the Security tab of the repository
34+
35+
**Trigger:**
36+
- Automatically runs on push and pull request events on the main and dev branches
37+
- Scheduled to run weekly
38+
- Can be triggered manually through the GitHub Actions UI
39+
40+
### Documentation Build (`docs.yml`)
41+
42+
This workflow builds and deploys the project documentation to GitHub Pages.
43+
44+
**Features:**
45+
- Builds documentation using Sphinx
46+
- Deploys documentation to GitHub Pages when merged to main
47+
- Creates preview builds on pull requests
48+
49+
**Trigger:**
50+
- Automatically runs on push and pull request events on the main branch
51+
- Can be triggered manually through the GitHub Actions UI
52+
2553
### Check Contributor Agreement (`contributor-agreement-check.yml`)
2654

2755
This workflow ensures all contributors have signed the Contributor Agreement by checking for properly filled agreement files.
@@ -35,7 +63,10 @@ This workflow ensures all contributors have signed the Contributor Agreement by
3563
**Trigger:**
3664
- Automatically runs on all pull request events (opened, synchronized, reopened)
3765

66+
3867
## Running Workflows
3968

4069
- **tests:** These run automatically on push/PR to the main branch
70+
- **CodeQL Analysis:** Runs automatically on push/PR to main/dev, weekly, and manually
71+
- **Documentation Build:** Runs automatically on push/PR to main and manually
4172
- **Check Contributor Agreement:** Runs automatically on all PRs

.github/workflows/ci-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ main, dev ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ main, dev ]
88
workflow_dispatch:
99

1010
jobs:
@@ -92,6 +92,7 @@ jobs:
9292
update-badge:
9393
needs: tests-with-vcr
9494
runs-on: ubuntu-latest
95+
if: github.ref == 'refs/heads/main'
9596
steps:
9697
- name: Download coverage artifact
9798
uses: actions/download-artifact@v4

.github/workflows/codeql.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ name: "CodeQL"
22

33
on:
44
push:
5-
branches: [ dev ]
5+
branches: [ main, dev ]
6+
pull_request:
7+
branches: [ main, dev ]
68
schedule:
79
- cron: '0 0 * * 0' # Run once per week at midnight on Sunday
810
workflow_dispatch:

.github/workflows/contributor-agreement-check.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,44 @@ jobs:
1212
check-contributor-agreement:
1313
runs-on: ubuntu-latest
1414
steps:
15+
- name: Check if user is a maintainer
16+
id: check-maintainer
17+
uses: actions/github-script@v7
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
script: |
21+
const { owner, repo } = context.repo;
22+
const username = context.payload.pull_request.user.login;
23+
24+
try {
25+
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
26+
owner,
27+
repo,
28+
username,
29+
});
30+
31+
// Skip check for users with admin or write permissions
32+
if (['admin', 'write'].includes(permission.permission)) {
33+
console.log(`User ${username} is a maintainer with ${permission.permission} permissions. Skipping check.`);
34+
return true;
35+
}
36+
37+
console.log(`User ${username} has ${permission.permission} permissions. Continuing with check.`);
38+
return false;
39+
} catch (error) {
40+
console.log(`Error checking permissions: ${error}`);
41+
return false;
42+
}
43+
1544
- name: Checkout code
45+
if: steps.check-maintainer.outputs.result != 'true'
1646
uses: actions/checkout@v4
1747
with:
1848
ref: ${{ github.event.pull_request.head.sha }}
1949
fetch-depth: 0
2050

2151
- name: Check for contributor agreement
52+
if: steps.check-maintainer.outputs.result != 'true'
2253
id: check-agreement
2354
run: |
2455
# Get the PR author's username
@@ -50,6 +81,7 @@ jobs:
5081
fi
5182
5283
- name: Check for deleted contributor agreements
84+
if: steps.check-maintainer.outputs.result != 'true'
5385
id: check-deleted
5486
run: |
5587
# Set proper base ref
@@ -68,8 +100,8 @@ jobs:
68100
fi
69101
70102
- name: Comment on PR if checks fail
71-
if: ${{ failure() }}
72-
uses: actions/github-script@v6
103+
if: ${{ failure() && steps.check-maintainer.outputs.result != 'true' }}
104+
uses: actions/github-script@v7
73105
with:
74106
github-token: ${{ secrets.GITHUB_TOKEN }}
75107
script: |

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![License](https://img.shields.io/badge/License-Apache_2.0-bright.svg)](https://opensource.org/licenses/Apache-2.0)
1010
![PyPI](https://img.shields.io/pypi/v/contextgem)
1111
[![Python Versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/downloads/)
12+
[![Code Security](https://github.com/shcherbak-ai/contextgem/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/shcherbak-ai/contextgem/actions/workflows/codeql.yml)
1213
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1314
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat)](https://pycqa.github.io/isort/)
1415
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
@@ -297,6 +298,13 @@ ContextGem is at an early stage. Our development roadmap includes:
297298
We are committed to making ContextGem the most effective tool for extracting structured information from documents.
298299

299300

301+
## 🔐 Security
302+
303+
This project is automatically scanned for security vulnerabilities using [CodeQL](https://codeql.github.com/). We also use [Snyk](https://snyk.io) as needed for supplementary dependency checks.
304+
305+
See [SECURITY](https://github.com/shcherbak-ai/contextgem/blob/main/SECURITY.md) file for details.
306+
307+
300308
## 📄 License & Contact
301309

302310
This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/shcherbak-ai/contextgem/blob/main/LICENSE) and [NOTICE](https://github.com/shcherbak-ai/contextgem/blob/main/NOTICE) files for details.

SECURITY.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ We maintain security practices for the latest release of this library. Older ver
88

99
## Security Testing
1010

11-
This project is regularly tested for security issues using both:
11+
This project is automatically tested for security issues using [CodeQL](https://codeql.github.com/) static analysis (run via GitHub Actions).
1212

13-
- [CodeQL](https://codeql.github.com/) static analysis (run via GitHub Actions)
14-
- [Snyk](https://snyk.io) for continuous dependency vulnerability monitoring
15-
16-
All known transitive vulnerabilities have been manually triaged and either resolved or confirmed to be non-applicable based on how the library is used. See the repository's issue tracker or changelog for relevant audit notes when applicable.
13+
We also use [Snyk](https://snyk.io) as needed for supplementary dependency vulnerability monitoring.
1714

1815

1916
## Data Privacy

dev/readme.template.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![License](https://img.shields.io/badge/License-Apache_2.0-bright.svg)](https://opensource.org/licenses/Apache-2.0)
1010
![PyPI](https://img.shields.io/pypi/v/contextgem)
1111
[![Python Versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue)](https://www.python.org/downloads/)
12+
[![Code Security](https://github.com/shcherbak-ai/contextgem/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/shcherbak-ai/contextgem/actions/workflows/codeql.yml)
1213
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1314
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat)](https://pycqa.github.io/isort/)
1415
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://pydantic.dev)
@@ -126,6 +127,13 @@ ContextGem is at an early stage. Our development roadmap includes:
126127
We are committed to making ContextGem the most effective tool for extracting structured information from documents.
127128

128129

130+
## 🔐 Security
131+
132+
This project is automatically scanned for security vulnerabilities using [CodeQL](https://codeql.github.com/). We also use [Snyk](https://snyk.io) as needed for supplementary dependency checks.
133+
134+
See [SECURITY](https://github.com/shcherbak-ai/contextgem/blob/main/SECURITY.md) file for details.
135+
136+
129137
## 📄 License & Contact
130138

131139
This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/shcherbak-ai/contextgem/blob/main/LICENSE) and [NOTICE](https://github.com/shcherbak-ai/contextgem/blob/main/NOTICE) files for details.

0 commit comments

Comments
 (0)