Skip to content

Commit 79b27dd

Browse files
HeyItsGilbertclaude
andcommitted
Add event submission workflow and update Hugo version
- add-event.yml: on approved label, parses the community-event issue form and opens a PR creating the content/calendar/*.md file - community-event.yml: minor field description improvements - hugo.yml: bump Hugo 0.121.0 -> 0.155.1 (required for Hugo modules) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3d056b2 commit 79b27dd

3 files changed

Lines changed: 114 additions & 15 deletions

File tree

.github/ISSUE_TEMPLATE/community-event.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ body:
77
attributes:
88
value: |
99
Thanks for submitting an event to the PowerShell.org community calendar!
10-
Please fill out the details below.
10+
Please fill out the details below. A maintainer will review and approve it.
1111
1212
- type: input
1313
id: event_name
@@ -29,23 +29,26 @@ body:
2929
id: start_date
3030
attributes:
3131
label: Start Date
32-
placeholder: "YYYY-MM-DD"
32+
description: "Format: YYYY-MM-DD"
33+
placeholder: "2026-10-15"
3334
validations:
3435
required: true
3536

3637
- type: input
3738
id: end_date
3839
attributes:
39-
label: End Date (leave blank for single-day events)
40-
placeholder: "YYYY-MM-DD"
40+
label: End Date
41+
description: "Format: YYYY-MM-DD — leave blank for single-day events"
42+
placeholder: "2026-10-17"
4143
validations:
4244
required: false
4345

4446
- type: input
4547
id: location
4648
attributes:
4749
label: Location
48-
placeholder: "City, State/Country or 'Virtual'"
50+
description: "City, State/Country — use 'Virtual' for online-only events"
51+
placeholder: "Austin, TX"
4952
validations:
5053
required: true
5154

@@ -64,14 +67,7 @@ body:
6467
id: description
6568
attributes:
6669
label: Event Description
67-
placeholder: "Brief description of the event (1-2 sentences)."
70+
description: "1–2 sentences shown on the calendar page."
71+
placeholder: "Brief description of the event."
6872
validations:
6973
required: true
70-
71-
- type: textarea
72-
id: additional_info
73-
attributes:
74-
label: Additional Information
75-
placeholder: "Anything else we should know? (e.g., CFP deadlines, discount codes, etc.)"
76-
validations:
77-
required: false

.github/workflows/add-event.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Add Community Event
2+
3+
on:
4+
issues:
5+
types: [labeled]
6+
7+
jobs:
8+
add-event:
9+
if: |
10+
github.event.label.name == 'approved' &&
11+
contains(github.event.issue.labels.*.name, 'community-event')
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Parse issue and create event content file
22+
id: parse
23+
env:
24+
ISSUE_BODY: ${{ github.event.issue.body }}
25+
ISSUE_NUMBER: ${{ github.event.issue.number }}
26+
ISSUE_TITLE: ${{ github.event.issue.title }}
27+
run: |
28+
python3 - <<'PYEOF'
29+
import os, re
30+
31+
body = os.environ['ISSUE_BODY']
32+
issue_num = os.environ['ISSUE_NUMBER']
33+
34+
def field(label):
35+
m = re.search(rf'### {re.escape(label)}\s+(.+?)(?=\n###|\Z)', body, re.DOTALL)
36+
if not m:
37+
return ''
38+
val = m.group(1).strip()
39+
return '' if val in ('_No response_', '') else val
40+
41+
name = field('Event Name')
42+
url = field('Event Website')
43+
start_date = field('Start Date')
44+
end_date = field('End Date')
45+
location = field('Location')
46+
virtual_s = field('Is this a virtual event?')
47+
description = field('Event Description')
48+
49+
virtual = 'true' if virtual_s.startswith(('Yes', 'Hybrid')) else 'false'
50+
51+
# Generate a URL-safe slug: name + year
52+
slug = re.sub(r'[^a-z0-9]+', '-', name.lower()).strip('-')
53+
slug = f"{slug}-{start_date[:4]}"
54+
55+
end_line = f'\nendDate: "{end_date}"' if end_date else ''
56+
content = f"""---
57+
title: "{name}"
58+
startDate: "{start_date}"{end_line}
59+
where: "{location}"
60+
externalUrl: "{url}"
61+
virtual: {virtual}
62+
---
63+
{description}
64+
"""
65+
# Dedent (the heredoc indents every line)
66+
import textwrap
67+
content = textwrap.dedent(content)
68+
69+
filepath = f'content/calendar/{slug}.md'
70+
os.makedirs('content/calendar', exist_ok=True)
71+
with open(filepath, 'w') as f:
72+
f.write(content)
73+
74+
with open(os.environ['GITHUB_OUTPUT'], 'a') as out:
75+
out.write(f'slug={slug}\n')
76+
out.write(f'filepath={filepath}\n')
77+
out.write(f'event_name={name}\n')
78+
79+
print(f'Created {filepath}')
80+
PYEOF
81+
82+
- name: Open PR
83+
env:
84+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
SLUG: ${{ steps.parse.outputs.slug }}
86+
FILEPATH: ${{ steps.parse.outputs.filepath }}
87+
EVENT_NAME: ${{ steps.parse.outputs.event_name }}
88+
ISSUE_NUMBER: ${{ github.event.issue.number }}
89+
run: |
90+
BRANCH="event/issue-${ISSUE_NUMBER}-${SLUG}"
91+
git config user.name "github-actions[bot]"
92+
git config user.email "github-actions[bot]@users.noreply.github.com"
93+
git checkout -b "$BRANCH"
94+
git add "$FILEPATH"
95+
git commit -m "Add event: ${EVENT_NAME} (closes #${ISSUE_NUMBER})"
96+
git push origin "$BRANCH"
97+
gh pr create \
98+
--title "Add event: ${EVENT_NAME}" \
99+
--body "Closes #${ISSUE_NUMBER}
100+
101+
Auto-generated from community event submission." \
102+
--base main \
103+
--head "$BRANCH"

.github/workflows/hugo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
build-and-deploy:
1616
runs-on: ubuntu-latest
1717
env:
18-
HUGO_VERSION: 0.121.0
18+
HUGO_VERSION: 0.155.1
1919
steps:
2020
- name: Install Hugo CLI
2121
run: |

0 commit comments

Comments
 (0)