Skip to content

Commit 7ea3197

Browse files
committed
Add project submission
1 parent d6a1856 commit 7ea3197

File tree

8 files changed

+343
-39
lines changed

8 files changed

+343
-39
lines changed

.github/workflows/projects.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Process Project Submission
2+
3+
on:
4+
issues:
5+
types: [edited]
6+
7+
jobs:
8+
process-issue:
9+
# Only run if the issue has the specific label to avoid processing random issues
10+
if: contains(github.event.issue.labels.*.name, 'project-submission')
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write # Needed to push the JSON file back to the repo
14+
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Parse Issue and Save JSON
25+
env:
26+
ISSUE_BODY: ${{ github.event.issue.body }}
27+
ISSUE_NUMBER: ${{ github.event.issue.number }}
28+
run: |
29+
python scripts/parse_issue.py
30+
31+
- name: Commit and Push Changes
32+
uses: stefanzweifel/git-auto-commit-action@v5
33+
with:
34+
commit_message: "Update project data for Issue #${{ github.event.issue.number }}"
35+
file_pattern: "data/projects/*.json"

_site/index.html.j2

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<br>
5353
<a href="{{registration_link}}" class="btn btn-dark btn-lg top5 left5">{{registration_text}}</a>
5454
<a href="{{discord_link}}" target="_blank" class="btn btn-dark btn-lg top5 left5">Join on Brainhack Montreal Discord</a>
55-
<!-- <a href="{{project_submit_link}}" target="_blank" class="btn btn-dark btn-lg top5 left5">Submit a Project</a><br><br> -->
55+
<a href="{{project_submit_link}}" target="_blank" class="btn btn-dark btn-lg top5 left5">Submit a Project</a><br><br>
5656
</header>
5757

5858
<!-- Services -->
@@ -121,24 +121,6 @@
121121
</small>
122122
</section>
123123

124-
<!-- Brainhack -->
125-
<!-- The circle icons use Font Awesome's stacked icon classes. For more information, visit http://fontawesome.io/examples/ -->
126-
<section id="details" class="details">
127-
<div class="container">
128-
<div class="row">
129-
<div class="col-xl-8 col-xl-offset-2 col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12 col-xs-offset-0">
130-
<p><h3 class="text-center">Why Brainhack?</h3></p>
131-
{% for service in services %}
132-
<p>
133-
<span class="hl"><i class="fa-solid {{service.fa_icon}}"></i> {{service.title}} </span>
134-
{{service.desc}}
135-
</p>
136-
{% endfor%}
137-
</div>
138-
</div>
139-
</div>
140-
</section>
141-
142124
<!-- Schedule -->
143125
<aside class="workspace" id="schedule">
144126
<div class="container">
@@ -179,7 +161,6 @@
179161
</div>
180162
</aside>
181163

182-
{# TODO uncomment when project submission is open
183164
<!-- Projects -->
184165
<!-- The circle icons use Font Awesome's stacked icon classes. For more information, visit http://fontawesome.io/examples/ -->
185166
<section id="projects" class="services bg-primary">
@@ -193,7 +174,6 @@
193174
</div>
194175
</div>
195176
</section>
196-
#}
197177

198178
<section id="sponsors" class="no-padding">
199179
<div class="container-fluid">

_site/projects.html

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<meta name="description" content="Brainhack Projects">
9+
<meta name="author" content="">
10+
11+
<title>Projects - Brainhack Montreal Winter 2026</title>
12+
13+
<link href="css/bootstrap.min.css" rel="stylesheet">
14+
<link href="css/stylish-portfolio.css" rel="stylesheet">
15+
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
16+
<link href='https://fonts.googleapis.com/css?family=Comfortaa:700' rel='stylesheet' type='text/css'>
17+
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css' rel='stylesheet' type='text/css'>
18+
</head>
19+
20+
<style>
21+
a {
22+
color: rgb(0, 103, 165) !important;
23+
}
24+
.btn {
25+
color: #fff !important;
26+
}
27+
</style>
28+
29+
<body>
30+
31+
<header class="header" style="min-height: 40vh; height: auto; padding-bottom: 50px;">
32+
<div class="text-vertical-center text-center">
33+
<h1 style="margin-top: 100px;">Brainhack Montreal Winter 2026 Projects</h1>
34+
<br>
35+
<a href="index.html" class="btn btn-dark btn-lg">Back to Home</a>
36+
</div>
37+
</header>
38+
39+
<section id="projects" class="services bg-primary">
40+
<div class="container">
41+
<div class="row">
42+
<div class="col-lg-10 col-lg-offset-1 text-center">
43+
<h2>Submitted Projects</h2>
44+
<hr class="small">
45+
46+
47+
<div class="row">
48+
49+
<div class="col-md-12" style="margin-bottom: 30px;">
50+
<div class="service-item" style="padding: 30px; background: #fff; color: #333; border-radius: 10px; text-align: left;">
51+
<h3 class="text-center"><p>Test website integration</p>
52+
</h3>
53+
54+
<p><strong><i class="fa fa-users"></i> Leaders:</strong> <p>@mathdugre</p>
55+
</p>
56+
57+
<hr>
58+
<p style="white-space: pre-wrap;"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean at neque ac erat gravida ullamcorper. Donec dapibus vel tortor ac fermentum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In vulputate interdum porttitor. Nam et sem auctor, lobortis libero non, euismod arcu.</p>
59+
<p>Link test: <a href="https://brainhackmtl.github.io/winter2026/">https://brainhackmtl.github.io/winter2026/</a></p>
60+
</p>
61+
62+
<div class="text-center" style="margin-top: 20px;">
63+
64+
<a href="https://github.com/BrainhackMTL/winter2026/issues/1" target="_blank" class="btn btn-primary">
65+
<i class="fa-brands fa-github"></i> View / Join on GitHub
66+
</a>
67+
68+
</div>
69+
</div>
70+
</div>
71+
72+
</div>
73+
74+
</div>
75+
</div>
76+
</div>
77+
</section>
78+
</body>
79+
</html>

_site/projects.html.j2

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<meta name="description" content="Brainhack Projects">
9+
<meta name="author" content="">
10+
11+
<title>Projects - {{title}}</title>
12+
13+
<link href="css/bootstrap.min.css" rel="stylesheet">
14+
<link href="css/stylish-portfolio.css" rel="stylesheet">
15+
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
16+
<link href='https://fonts.googleapis.com/css?family=Comfortaa:700' rel='stylesheet' type='text/css'>
17+
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css' rel='stylesheet' type='text/css'>
18+
</head>
19+
20+
<style>
21+
a {
22+
color: {{color_theme.primary}} !important;
23+
}
24+
.btn {
25+
color: {{color_theme.font}} !important;
26+
}
27+
</style>
28+
29+
<body>
30+
31+
<header class="header" style="min-height: 40vh; height: auto; padding-bottom: 50px;">
32+
<div class="text-vertical-center text-center">
33+
<h1 style="margin-top: 100px;">{{title}} Projects</h1>
34+
<br>
35+
<a href="index.html" class="btn btn-dark btn-lg">Back to Home</a>
36+
</div>
37+
</header>
38+
39+
<section id="projects" class="services bg-primary">
40+
<div class="container">
41+
<div class="row">
42+
<div class="col-lg-10 col-lg-offset-1 text-center">
43+
<h2>Submitted Projects</h2>
44+
<hr class="small">
45+
46+
{% if projects %}
47+
<div class="row">
48+
{% for project in projects %}
49+
<div class="col-md-12" style="margin-bottom: 30px;">
50+
<div class="service-item" style="padding: 30px; background: #fff; color: #333; border-radius: 10px; text-align: left;">
51+
<h3 class="text-center">{{ project.get('Title', 'Untitled Project') }}</h3>
52+
53+
<p><strong><i class="fa fa-users"></i> Leaders:</strong> {{ project.get('Leaders', 'Unknown') }}</p>
54+
55+
<hr>
56+
<p style="white-space: pre-wrap;">{{ project.get('Project Description', 'No description provided.') }}</p>
57+
58+
<div class="text-center" style="margin-top: 20px;">
59+
{% if project.get('issue_url') %}
60+
<a href="{{ project['issue_url'] }}" target="_blank" class="btn btn-primary">
61+
<i class="fa-brands fa-github"></i> View / Join on GitHub
62+
</a>
63+
{% endif %}
64+
</div>
65+
</div>
66+
</div>
67+
{% endfor %}
68+
</div>
69+
{% else %}
70+
<div class="row">
71+
<div class="col-md-12">
72+
<p class="lead">No projects have been submitted yet.</p>
73+
<a href="{{ project_submit_link }}" target="_blank" class="btn btn-dark btn-lg">Submit a Project</a>
74+
</div>
75+
</div>
76+
{% endif %}
77+
</div>
78+
</div>
79+
</div>
80+
</section>
81+
</body>
82+
</html>

data.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"registration_text": "Registration Open Now!",
1616
"survey_link": "",
1717
"discord_link": "https://discord.gg/wysCYqTWyM",
18-
"project_link": "https://brainhack.org/global2025/projects/",
19-
"project_submit_link": "https://github.com/brainhackorg/global2025/issues/new?assignees=&labels=project&template=project-submission-template.yml",
18+
"project_link": "projects.html",
19+
"project_submit_link": "https://github.com/BrainhackMTL/winter2026/issues/new?template=project-submission-template.yml",
2020
"project_submit_icon": "fa-child",
2121
"title_photo_link": "https://upload.wikimedia.org/wikipedia/commons/2/2c/Montreal_-_QC_-_Skyline.jpg",
2222
"services": [

generator.py

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,71 @@
11
__author__ = "akeshavan"
2-
from jinja2 import Environment, FileSystemLoader
2+
import glob
33
import json
44
import os
55

6+
from jinja2 import Environment, FileSystemLoader
67

7-
def load_json(filename):
8-
"""Load data from a json file
9-
Parameters
10-
----------
11-
filename : str
12-
Filename to load data from.
13-
Returns
14-
-------
15-
data : dict
16-
"""
178

9+
def load_json(filename):
10+
"""Load data from a json file"""
1811
with open(filename, "r") as fp:
1912
data = json.load(fp)
2013
return data
2114

2215

16+
def load_projects(directory):
17+
"""
18+
Scans the 'data/projects' directory for JSON files,
19+
loads them, and adds a link to the original GitHub issue.
20+
"""
21+
projects = []
22+
# Check if directory exists to avoid errors on fresh clones
23+
if not os.path.exists(directory):
24+
print(f"Warning: Directory {directory} not found. No projects loaded.")
25+
return projects
26+
27+
# Glob all json files
28+
for filename in glob.glob(os.path.join(directory, "*.json")):
29+
try:
30+
data = load_json(filename)
31+
32+
# Construct the issue URL based on the repo name
33+
# You can also customize this if your repo changes
34+
if "issue_number" in data:
35+
data["issue_url"] = (
36+
f"https://github.com/BrainhackMTL/winter2026/issues/{data['issue_number']}"
37+
)
38+
39+
projects.append(data)
40+
except Exception as e:
41+
print(f"Skipping {filename}: {e}")
42+
43+
# Optional: Sort projects by issue number (earliest first)
44+
projects.sort(key=lambda x: int(x.get("issue_number", 0)))
45+
return projects
46+
47+
2348
files_to_generate = [
2449
{"filename": "index.html.j2", "location": "./_site"},
50+
{"filename": "projects.html.j2", "location": "./_site"}, # New projects page
2551
{"filename": "css/stylish-portfolio.css.j2", "location": "./_site"},
2652
]
2753

2854
env = Environment(loader=FileSystemLoader("./_site"))
2955
info = load_json("data.json")
3056

57+
# Load the project data and add it to the 'info' dictionary
58+
info["projects"] = load_projects("data/projects")
59+
3160
for f in files_to_generate:
32-
template = env.get_template(f["filename"])
33-
outfile = os.path.join(f["location"], f["filename"].replace(".j2", ""))
34-
print("writing", outfile)
35-
with open(outfile, "w") as q:
36-
q.write(template.render(**info))
61+
try:
62+
template = env.get_template(f["filename"])
63+
# Handle the output filename (remove .j2)
64+
outfile_name = f["filename"].replace(".j2", "")
65+
outfile = os.path.join(f["location"], outfile_name)
66+
67+
print("writing", outfile)
68+
with open(outfile, "w", encoding="utf-8") as q:
69+
q.write(template.render(**info))
70+
except Exception as e:
71+
print(f"Error generating {f['filename']}: {e}")

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[project]
2+
name = "winter2026"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"jinja2>=3.1.6",
9+
"markdown-it-py>=4.0.0",
10+
]

0 commit comments

Comments
 (0)