Skip to content

Commit 041f372

Browse files
authored
Merge pull request #335 from EducationalTools/main
updates, add some gmaes, features and analytics
2 parents 499796b + 23ab04c commit 041f372

File tree

605 files changed

+218345
-59
lines changed

Some content is hidden

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

605 files changed

+218345
-59
lines changed

.coderabbit.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# yaml-language-server: $schema=https://storage.googleapis.com/coderabbit_public_assets/schema.v2.json
2+
enable_free_tier: true
3+
reviews:
4+
review_status: true
5+
poem: false
6+
profile: chill
7+
path_instructions:
8+
- path: '**/*.*'
9+
instructions: |
10+
Do not correct spelling errors or grammar mistakes.
11+
auto_review:
12+
enabled: true
13+
base_branches:
14+
- main
15+
- prod
16+
tools:
17+
languagetool:
18+
enabled: false

.github/dependabot.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ updates:
88
- package-ecosystem: 'npm' # See documentation for possible values
99
directory: '/' # Location of package manifests
1010
schedule:
11-
interval: 'daily'
12-
assignees:
13-
- Inglan
11+
interval: 'weekly'
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Move Project Items to Production'
2+
3+
on:
4+
push:
5+
branches:
6+
- prod
7+
8+
jobs:
9+
move_to_production:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.13'
18+
- uses: actions/create-github-app-token@v1
19+
id: app-token
20+
with:
21+
app-id: ${{ secrets.GH_APP_ID }}
22+
private-key: ${{ secrets.GH_PRIVATE_KEY }}
23+
- name: Install dependencies
24+
run: |
25+
python -m venv venv
26+
venv/bin/pip install requests
27+
- name: Move items from Done to In Production
28+
run: |
29+
venv/bin/python ci/scripts/move_to_production.py \
30+
-t ${{ steps.app-token.outputs.token }} \
31+
-o EducationalTools \
32+
-p 4

ci/README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# CI/CD Automation Scripts
2+
3+
This directory contains automation scripts for managing GitHub issues and project boards.
4+
5+
## Scripts Overview
6+
7+
### 1. `issue.py` - Issue Management
8+
9+
Automatically processes GitHub issues, particularly game requests:
10+
11+
- Detects issues with `[Gmae Request]` prefix
12+
- Searches for relevant links on GitHub Pages
13+
- Posts automated comments with search results
14+
15+
### 2. `move_to_production.py` - Project Board Automation
16+
17+
Moves project items from "Done" status to "In Production" status:
18+
19+
- Queries GitHub Projects v2 API using GraphQL
20+
- Finds all items with status "Done"
21+
- Updates them to "In Production" status
22+
- Used for production deployment automation
23+
24+
### 3. `test_production_move.py` - Testing Script
25+
26+
Manual testing script for the production move operation:
27+
28+
- Allows testing the move operation without triggering workflows
29+
- Supports dry-run mode (future enhancement)
30+
- Useful for debugging and validation
31+
32+
## GitHub Workflows
33+
34+
### Issue Management (`.github/workflows/issue.yml`)
35+
36+
Triggers on:
37+
38+
- Issue opened
39+
- Issue edited
40+
41+
Actions:
42+
43+
- Runs `issue.py` script
44+
- Posts automated comments for game requests
45+
46+
### Production Deployment (`.github/workflows/production_deploy.yml`)
47+
48+
Triggers on:
49+
50+
- Push to `prod` branch
51+
52+
Actions:
53+
54+
- Runs `move_to_production.py` script
55+
- Moves all "Done" items to "In Production" in project #4
56+
57+
## Setup Requirements
58+
59+
### GitHub App Configuration
60+
61+
Both workflows use a GitHub App for authentication:
62+
63+
1. **Secrets Required:**
64+
65+
- `GH_APP_ID` - Your GitHub App ID
66+
- `GH_PRIVATE_KEY` - Your GitHub App private key
67+
68+
2. **App Permissions:**
69+
- Issues: Read & Write (for issue comments)
70+
- Projects: Read & Write (for project board updates)
71+
- Repository: Read (for workflow access)
72+
73+
### Project Configuration
74+
75+
The production deployment script assumes:
76+
77+
- Organization: `EducationalTools`
78+
- Project number: `4`
79+
- Status field with options: "Done" and "In Production"
80+
81+
These can be customized by modifying the workflow or script parameters.
82+
83+
## Usage
84+
85+
### Automatic Usage
86+
87+
The workflows run automatically based on their triggers:
88+
89+
- Issue workflow: When issues are opened/edited
90+
- Production workflow: When code is pushed to `prod` branch
91+
92+
### Manual Testing
93+
94+
To test the production move operation manually:
95+
96+
```bash
97+
# Install dependencies
98+
pip install requests
99+
100+
# Test with your GitHub token
101+
python ci/scripts/test_production_move.py --token YOUR_GITHUB_TOKEN
102+
103+
# Test with different organization/project
104+
python ci/scripts/test_production_move.py \
105+
--token YOUR_TOKEN \
106+
--org YourOrganization \
107+
--project 5
108+
```
109+
110+
### Direct Script Usage
111+
112+
You can also run the scripts directly:
113+
114+
```bash
115+
# Process a specific issue
116+
python ci/scripts/issue.py -n 123 -t YOUR_TOKEN
117+
118+
# Move project items to production
119+
python ci/scripts/move_to_production.py -t YOUR_TOKEN -o EducationalTools -p 4
120+
```
121+
122+
## Dependencies
123+
124+
- `requests` - HTTP client for GitHub API calls
125+
- `googlesearch-python` - For searching game links (issue.py only)
126+
127+
## Error Handling
128+
129+
The scripts include error handling for common scenarios:
130+
131+
- Invalid tokens or permissions
132+
- Missing projects or fields
133+
- Network issues
134+
- GraphQL API errors
135+
136+
## GraphQL Queries
137+
138+
The project automation uses GitHub's GraphQL API v4 for efficient data retrieval and mutations. Key operations:
139+
140+
1. **Project Data Query** - Gets project ID and field information
141+
2. **Items Query** - Retrieves all project items with their status values
142+
3. **Update Mutation** - Changes item status from "Done" to "In Production"
143+
144+
## Future Enhancements
145+
146+
Potential improvements:
147+
148+
- Dry-run mode for testing changes
149+
- Support for custom field names
150+
- Better error reporting and logging
151+
- Slack/Discord notifications
152+
- Rollback capabilities

0 commit comments

Comments
 (0)