Skip to content

Commit 3dfb464

Browse files
authored
chore: Docs and Repo updates (#133)
* API docs generation. Pre-commit hooks. * Finalizing docs updates * Spelling fix * Some workflow updates * type fix
1 parent ee16dba commit 3dfb464

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+15543
-261
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include:
1616

1717
- Using welcoming and inclusive language
1818
- Being respectful of differing viewpoints and experiences
19-
- Gracefully accepting constructive criticism
19+
- gracefully accepting constructive criticism
2020
- Focusing on what is best for the community
2121
- Showing empathy towards other community members
2222

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## Notes
22

3-
-
3+
-
44

5-
---
5+
---

.github/workflows/ci.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
---
12
name: Lint, Typecheck, and Test
23

34
on:
45
push:
5-
branches: [ main ]
6+
branches: [main]
67
pull_request:
7-
branches: [ main ]
8+
branches: [main]
89

910
jobs:
1011
ci:
@@ -19,11 +20,6 @@ jobs:
1920
- name: Checkout code
2021
uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2
2122

22-
- name: Setup Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@5db1cf9a59fb97c40a68accab29236f0da7e94db
24-
with:
25-
python-version: ${{ matrix.python-version }}
26-
2723
- name: Install Poetry
2824
uses: abatilo/actions-poetry@b8f6fe29ba2eb78e0d45ccbf41cd14154c4e25b2
2925

@@ -32,13 +28,11 @@ jobs:
3228
poetry config virtualenvs.create true --local
3329
poetry config virtualenvs.in-project true --local
3430
35-
- name: Cache dependencies
36-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
31+
- name: Setup Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@5db1cf9a59fb97c40a68accab29236f0da7e94db
3733
with:
38-
path: ./.venv
39-
key: venv-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
40-
restore-keys: |
41-
venv-${{ runner.os }}-py${{ matrix.python-version }}-
34+
python-version: ${{ matrix.python-version }}
35+
cache: "poetry"
4236

4337
- name: Install package
4438
run: poetry install --all-extras
@@ -50,4 +44,4 @@ jobs:
5044
run: poetry run mypy rigging
5145

5246
- name: Test
53-
run: poetry run pytest
47+
run: poetry run pytest

.github/workflows/docs-update.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: Notify Documentation Update
3+
4+
on:
5+
push:
6+
branches: [main]
7+
paths:
8+
- "docs/**"
9+
- ".hooks/generate_docs.py"
10+
- ".github/workflows/docs-update.yaml"
11+
workflow_dispatch:
12+
13+
jobs:
14+
notify-docs:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
18+
id: app-token
19+
with:
20+
app-id: ${{ vars.UPDATE_DOCS_APP_ID }}
21+
private-key: ${{ secrets.UPDATE_DOCS_PRIVATE_KEY }}
22+
owner: "${{ github.repository_owner }}"
23+
repositories: |
24+
sdk
25+
prod-docs
26+
27+
- name: Trigger docs repository workflow
28+
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
29+
with:
30+
token: ${{ steps.app-token.outputs.token }}
31+
repository: dreadnode/prod-docs
32+
event-type: code-update
33+
client-payload: |
34+
{
35+
"repository": "${{ github.repository }}",
36+
"ref": "${{ github.ref }}",
37+
"sha": "${{ github.sha }}",
38+
"source_dir": "docs",
39+
"target_dir": "open-source/rigging",
40+
"nav_target": "Open Source/Rigging"
41+
}

.github/workflows/publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Build and Publish
23

34
on:
@@ -46,4 +47,4 @@ jobs:
4647
run: poetry build
4748

4849
- name: Publish to PyPI
49-
uses: pypa/gh-action-pypi-publish@e9ccbe5a211ba3e8363f472cae362b56b104e796
50+
uses: pypa/gh-action-pypi-publish@e9ccbe5a211ba3e8363f472cae362b56b104e796

.github/workflows/rigging_pr_description.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Update PR Description with Rigging
23

34
on:
@@ -31,22 +32,23 @@ jobs:
3132
env:
3233
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3334
run: |
34-
DESCRIPTION=$(uv run --no-project .github/scripts/generate_pr_description.py --base-ref origin/${{ github.base_ref }} --exclude *.lock)
35-
echo "description<<EOF" >> $GITHUB_OUTPUT
36-
echo "$DESCRIPTION" >> $GITHUB_OUTPUT
37-
echo "EOF" >> $GITHUB_OUTPUT
35+
DESCRIPTION="$(uv run --no-project .hooks/generate_pr_description.py --base-ref "origin/${{ github.base_ref }}" --exclude "./*.lock")"
36+
{
37+
echo "description<<EOF"
38+
echo "${DESCRIPTION}"
39+
echo "EOF"
40+
} >> "$GITHUB_OUTPUT"
3841
3942
- name: Update PR Description
4043
uses: nefrob/pr-description@4dcc9f3ad5ec06b2a197c5f8f93db5e69d2fdca7 # v1.2.0
4144
with:
4245
token: ${{ secrets.GITHUB_TOKEN }}
4346
content: |
44-
47+
4548
---
46-
49+
4750
## Generated Summary
4851
4952
${{ steps.description.outputs.description }}
5053
5154
This summary was generated with ❤️ by [rigging](https://docs.dreadnode.io/rigging/)
52-
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: "Semantic Lints PR"
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
- reopened
12+
13+
permissions:
14+
pull-requests: read
15+
16+
jobs:
17+
main:
18+
name: Validate PR title
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/semgrep.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
name: Semgrep Analysis
3+
on:
4+
merge_group:
5+
pull_request:
6+
branches:
7+
- main
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
push:
13+
branches:
14+
- main
15+
schedule:
16+
- cron: "0 0 * * *" # Run daily at midnight UTC
17+
18+
concurrency:
19+
group: pre-commit-${{ github.run_id }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
actions: read
24+
checks: write
25+
contents: read
26+
pull-requests: write # Allows merge queue updates
27+
security-events: write # Required for GitHub Security tab
28+
29+
jobs:
30+
semgrep:
31+
name: Semgrep Analysis
32+
runs-on: ubuntu-latest
33+
container:
34+
image: returntocorp/semgrep
35+
36+
# Skip any PR created by dependabot to avoid permission issues:
37+
if: (github.actor != 'dependabot[bot]')
38+
39+
steps:
40+
- name: Set up git repository
41+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Configure Git Safe Directory
46+
run: git config --global --add safe.directory "${GITHUB_WORKSPACE}"
47+
48+
- name: Semgrep Analysis
49+
env:
50+
SEMGREP_RULES: >-
51+
p/python
52+
p/security-audit
53+
p/secrets
54+
p/owasp-top-ten
55+
p/supply-chain
56+
SEMGREP_TIMEOUT: 300 # 5-minute timeout per rule
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
run: |
59+
semgrep ci \
60+
--config="${SEMGREP_RULES}" \
61+
--timeout="${SEMGREP_TIMEOUT}" \
62+
--sarif --output=semgrep-results.sarif
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: Template Sync
3+
on:
4+
# checkov:skip=CKV_GHA_7: "Workflow dispatch inputs are required for manual debugging and configuration"
5+
workflow_dispatch:
6+
inputs:
7+
dryRun:
8+
description: Dry Run
9+
default: "false"
10+
required: false
11+
logLevel:
12+
description: Log Level
13+
default: "debug"
14+
required: false
15+
16+
schedule:
17+
# Run on the 1st of every month at 00:00 UTC
18+
- cron: "0 0 1 * *"
19+
20+
push:
21+
branches: ["main"]
22+
paths:
23+
- ".github/**"
24+
- ".hooks/**"
25+
- ".pre-commit-config.yaml"
26+
- ".mdlrc"
27+
- ".editorconfig"
28+
- "Taskfile.yaml"
29+
- ".task/**"
30+
31+
permissions:
32+
contents: write
33+
pull-requests: write
34+
35+
concurrency:
36+
group: ${{ github.workflow }}-${{ github.run_number || github.ref }}
37+
cancel-in-progress: true
38+
39+
jobs:
40+
template-sync:
41+
name: Template Sync
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Generate Token
45+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
46+
id: app-token
47+
with:
48+
app-id: "${{ secrets.BOT_APP_ID }}"
49+
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
50+
owner: "${{ github.repository_owner }}"
51+
52+
- name: Checkout
53+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
54+
with:
55+
token: "${{ steps.app-token.outputs.token }}"
56+
57+
- name: Template Sync
58+
uses: AndreasAugustin/actions-template-sync@v2
59+
with:
60+
source_gh_token: ${{ steps.app-token.outputs.token }}
61+
git_user_name: github-actions[bot]
62+
git_user_email: github-actions[bot]@users.noreply.github.com
63+
pr_title: "chore: sync infrastructure files with template"
64+
pr_labels: sync,template
65+
pr_body: |
66+
🤖 A new version of the python template files is available.
67+
68+
This PR was automatically created to sync the following:
69+
- GitHub Actions workflows
70+
- Pre-commit hooks and configs
71+
- Task definitions
72+
- Editor configs and linter rules
73+
74+
Please review the changes carefully before merging.
75+
source_repo_path: dreadnode/python-template
76+
steps: "prechecks,pull,commit,push,pr"
77+
upstream_branch: main

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,4 @@ cython_debug/
167167

168168
# macos
169169
.DS_Store
170-
.AppleDouble
170+
.AppleDouble

0 commit comments

Comments
 (0)