Skip to content

Commit 7014321

Browse files
feat(automation): transform into advanced autonomous repository
Implement comprehensive autonomous governance and maintenance systems: - Consolidated self-healing `repo-maintenance.yml` (autofix, doc sync, SBOM) - Added `tools/generate_knowledge_graph.py` (AST graph generation) - Added `tools/docs_sync.py` (AST API doc sync) - Added `tools/generate_architecture_diagrams.py` (SVG via pydeps) - Migrated CI validation scripts to robust ephemeral `uv run` commands - Added PR templates, `CODEOWNERS`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md` - Added fully automated contributor management (Greetings, Stale, Labeler) - Updated Node runners to standard v22. Co-authored-by: NITISH-R-G <225521762+NITISH-R-G@users.noreply.github.com>
1 parent c110413 commit 7014321

39 files changed

Lines changed: 537 additions & 83 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @NITISH-R-G

.github/labeler.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
frontend:
2+
- changed-files:
3+
- any-glob-to-any-file: 'web/**/*'
4+
5+
backend:
6+
- changed-files:
7+
- any-glob-to-any-file: 'server/**/*'
8+
- any-glob-to-any-file: 'ev_grid_oracle/**/*'
9+
10+
documentation:
11+
- changed-files:
12+
- any-glob-to-any-file: 'docs/**/*'
13+
- any-glob-to-any-file: '*.md'
14+
15+
tools:
16+
- changed-files:
17+
- any-glob-to-any-file: 'tools/**/*'
18+
19+
github-actions:
20+
- changed-files:
21+
- any-glob-to-any-file: '.github/**/*'
22+
23+
training:
24+
- changed-files:
25+
- any-glob-to-any-file: 'training/**/*'

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
pull_request:
7+
branches: [ "main", "master" ]
8+
9+
jobs:
10+
python-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
lfs: true
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install uv
23+
run: pip install uv
24+
25+
- name: Install dependencies
26+
run: |
27+
uv pip install --system -e ".[dev,demo]"
28+
29+
- name: Run tests
30+
run: uv run pytest tests/ -q --tb=line
31+
32+
frontend-build:
33+
runs-on: ubuntu-latest
34+
defaults:
35+
run:
36+
working-directory: ./web
37+
steps:
38+
- uses: actions/checkout@v4
39+
with:
40+
lfs: true
41+
42+
- name: Set up Node.js
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: '22'
46+
cache: 'npm'
47+
cache-dependency-path: ./web/package-lock.json
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Build frontend
53+
run: npm run build

.github/workflows/greetings.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Greetings
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
issues:
7+
types: [opened]
8+
9+
jobs:
10+
welcome:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/first-interaction@v1
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
issue-message: |
20+
Welcome to the EV Grid Oracle repository! 👋
21+
22+
Thank you for taking the time to open your first issue. We truly appreciate your contribution. One of our maintainers will take a look at it soon. In the meantime, please ensure you have provided as much context as possible.
23+
pr-message: |
24+
Welcome and thank you for opening your first pull request! 🚀
25+
26+
We are thrilled to have you contribute to EV Grid Oracle. Please make sure that your PR passes all checks and tests before requesting a review. You can run `./validate-submission.sh` locally to verify everything is in order.

.github/workflows/labeler.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Pull Request Labeler
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
triage:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
steps:
14+
- uses: actions/labeler@v5
15+
with:
16+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
17+
sync-labels: true
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Repository Maintenance
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
schedule:
7+
- cron: '0 2 * * *' # Daily at 2 AM UTC
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
maintenance:
14+
runs-on: ubuntu-latest
15+
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name == github.repository
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
ref: ${{ github.head_ref || github.ref }}
22+
lfs: true
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.10'
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '22'
33+
34+
- name: Install uv
35+
run: pip install uv
36+
37+
- name: Install dependencies
38+
run: |
39+
uv pip install --system -e ".[dev,demo]"
40+
uv pip install --system cyclonedx-bom
41+
42+
- name: Auto-fix formatting (ruff)
43+
run: |
44+
uv run --with ruff ruff check --fix .
45+
uv run --with ruff ruff format .
46+
47+
- name: Frontend Prettier (if needed)
48+
run: |
49+
if [ -d "web" ]; then
50+
cd web
51+
npm ci
52+
npx prettier --write .
53+
cd ..
54+
fi
55+
56+
- name: Generate Knowledge Graph
57+
run: python tools/generate_knowledge_graph.py
58+
59+
- name: Sync Documentation
60+
run: python tools/docs_sync.py
61+
62+
- name: Generate Architecture Diagrams
63+
run: python tools/generate_architecture_diagrams.py
64+
65+
- name: Generate SBOM
66+
run: cyclonedx-py environment -o bom.json
67+
68+
- name: Commit changes
69+
run: |
70+
git config --global user.name "github-actions[bot]"
71+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
72+
git add .
73+
git commit -m "chore(auto): apply autofixes, generate docs & architecture [skip ci]" || echo "No changes to commit"
74+
git push

.github/workflows/stale.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: '30 1 * * *'
6+
7+
jobs:
8+
stale:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
pull-requests: write
13+
steps:
14+
- uses: actions/stale@v9
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}
17+
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
18+
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
19+
days-before-stale: 30
20+
days-before-close: 5
21+
stale-issue-label: 'stale'
22+
stale-pr-label: 'stale'

CODE_OF_CONDUCT.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Contributing to EV Grid Oracle
2+
3+
First off, thank you for considering contributing to EV Grid Oracle! It's people like you that make open source such a great community.
4+
5+
## Development Setup
6+
We recommend using `uv` for python dependency management.
7+
8+
1. Install dependencies:
9+
```bash
10+
uv pip install -e ".[dev,demo]"
11+
```
12+
2. Build frontend:
13+
```bash
14+
cd web
15+
npm ci
16+
npm run build
17+
```
18+
3. Run tests locally:
19+
```bash
20+
./validate-submission.sh
21+
```
22+
23+
## Pull Request Process
24+
1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
25+
2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
26+
3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.
27+
28+
Thank you!

ev_grid_oracle/bescom_feed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def snapshot(
8585
return out
8686

8787
def _stable_seed(self, *, seed: int, scenario: str, tick: int) -> int:
88-
s = f"{seed}:{scenario}:{tick}".encode("utf-8")
88+
s = f"{seed}:{scenario}:{tick}".encode()
8989
h = sha1(s, usedforsecurity=False).hexdigest()[:8]
9090
return int(h, 16)
9191

0 commit comments

Comments
 (0)