Skip to content

Commit 4c33c08

Browse files
authored
Merge branch 'main' into 24-chore-template-ui-and-json-attributes-linkage
2 parents 5946a1a + 91adfe4 commit 4c33c08

6 files changed

Lines changed: 125 additions & 3 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: PR Conventional Commit Validation
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
issues: write
10+
11+
defaults:
12+
run:
13+
shell: bash
14+
15+
jobs:
16+
validate-pr-title:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
21+
with:
22+
egress-policy: audit
23+
24+
- name: PR Conventional Commit Validation
25+
uses: ytanikin/pr-conventional-commits@8267db1bacc237419f9ed0228bb9d94e94271a1d # v1.4.1
26+
with:
27+
task_types: '["feat","fix","docs","test","ci","refactor","perf","chore","revert"]'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ cython_debug/
174174
.pypirc
175175

176176

177-
.DS_Store
177+
**/**.DS_Store
178178
_site/*
179179
!_site/.gitkeep
180180

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
![App icon](VersionTwo/images/FullSizeIcon.png)
1+
![App icon](images/FullSizeIcon.png)
22

33
# VersionTwo
44
Hackathon project: CLI tool to generate static planning view of issues for better team planning
55

66
# Problem we are solving
7-
Github projects users are unable to easily associate issues across organizations with a project and particularly find having to manually add issues to the project board itself as a time consuming unnecessarily difficult task.
7+
GitHub projects users are unable to easily associate issues across organizations with a project and particularly find having to manually add issues to the project board itself as a time consuming unnecessarily difficult task.
88

99
We propose improving this interface by adding a simple HTTP page with an interactive Kanban which is able to aggregate a user provided selection of repos, projects, organizations and display them in a filterable way.
1010

images/.DS_Store

-6 KB
Binary file not shown.

images/favicon_io/.DS_Store

-6 KB
Binary file not shown.

src/v2query.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import json
5+
import shutil
6+
import requests
7+
from pathlib import Path
8+
from ghapi.all import GhApi
9+
from rich import print
10+
11+
MYTEAM = "platform-ci"
12+
TEMP_DIR = Path(f"{MYTEAM}.dir")
13+
OUTPUT_FILE = f"{MYTEAM}.items.json"
14+
15+
# Create GitHub API client (assumes GITHUB_TOKEN is set in env)
16+
api = GhApi()
17+
18+
# Step 1: Get list of orgs
19+
orgs = [org["login"] for org in api.orgs.list_for_authenticated_user()]
20+
21+
# Step 2: Query projects for each org
22+
all_projects = []
23+
for org in orgs:
24+
print(f"[bold blue]Fetching projects for org: {org}[/bold blue]")
25+
26+
query = """
27+
query($login: String!) {
28+
organization(login: $login) {
29+
projectsV2(first: 100) {
30+
nodes {
31+
id
32+
number
33+
title
34+
}
35+
}
36+
}
37+
}
38+
"""
39+
40+
headers = {"Authorization": f"Bearer {os.getenv('GITHUB_TOKEN')}"}
41+
response = requests.post(
42+
"https://api.github.com/graphql",
43+
json={"query": query, "variables": {"login": org}},
44+
headers=headers
45+
)
46+
result = response.json()
47+
projects = [
48+
{
49+
"org": org,
50+
"number": project["number"],
51+
"title": project["title"]
52+
}
53+
for project in result.get("data", {}).get("organization", {}).get("projectsV2", {}).get("nodes", [])
54+
]
55+
56+
all_projects.extend(projects)
57+
58+
# Step 3: Filter by team name in title
59+
matching_projects = [
60+
p for p in all_projects if MYTEAM.lower() in p["title"].lower()
61+
]
62+
63+
print(f"[green]Found {len(matching_projects)} matching projects for team '{MYTEAM}'[/green]")
64+
65+
# Step 4: Fetch items for each matching project
66+
TEMP_DIR.mkdir(exist_ok=True)
67+
for project in matching_projects:
68+
org = project["org"]
69+
number = project["number"]
70+
title = project["title"]
71+
72+
print(f"[cyan]Fetching items from: {title} (Org: {org}, Project: {number})[/cyan]")
73+
74+
# ghapi does not support the `gh project item-list` command yet,
75+
# so we use a subprocess call or GitHub REST if available.
76+
# We'll fallback to CLI for now.
77+
out_path = TEMP_DIR / f"{org}-{number}.items.json"
78+
os.system( f'gh project item-list --owner "{org}" {number} --format json > "{out_path}"')
79+
80+
# Step 5: Consolidate items
81+
all_items = []
82+
for file in TEMP_DIR.glob("*.items.json"):
83+
with open(file) as f:
84+
data = json.load(f)
85+
items = data.get("items", [])
86+
all_items.extend(items)
87+
88+
print(all_items)
89+
with open(OUTPUT_FILE, "w") as f:
90+
json.dump(all_items, f, indent=2)
91+
92+
print(f"[bold green]Saved all items to {OUTPUT_FILE}[/bold green]")
93+
94+
# Step 6: Cleanup
95+
shutil.rmtree(TEMP_DIR)

0 commit comments

Comments
 (0)