Skip to content

Commit 95cbf5c

Browse files
Add automated PR creation for regenerated glossary updates in data-processing workflow (#652)
* Initial plan * ci: open PR when regenerated glossary changes Co-authored-by: LukasWallrich <60155545+LukasWallrich@users.noreply.github.com> * ci: refine glossary PR workflow step robustness Co-authored-by: LukasWallrich <60155545+LukasWallrich@users.noreply.github.com> * Require option to regenerate Google Analytics data --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: LukasWallrich <60155545+LukasWallrich@users.noreply.github.com> Co-authored-by: Lukas Wallrich <lukas.wallrich@gmail.com>
1 parent 3d20abb commit 95cbf5c

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

.github/workflows/data-processing.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ on:
3535
required: false
3636
type: boolean
3737
default: false
38-
38+
regenerate_ga:
39+
description: 'Regenerate Google Analytics data'
40+
required: false
41+
type: boolean
42+
default: false
3943
jobs:
4044
process-data:
4145
name: Process Data
@@ -266,12 +270,47 @@ jobs:
266270
echo "All references resolved successfully"
267271
fi
268272
273+
#=======================================================
274+
# Create a pull request for glossary updates when regenerated
275+
#=======================================================
276+
- name: Create PR for glossary updates
277+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.regenerate_glossary == 'true'
278+
continue-on-error: true # Continue even if this step fails
279+
run: |
280+
echo "=== Creating PR for glossary updates ==="
281+
282+
if [ -z "$(git status --porcelain -- content/glossary)" ]; then
283+
echo "ℹ️ No glossary changes detected"
284+
exit 0
285+
fi
286+
287+
BRANCH_NAME="glossary-update-$(date +%Y%m%d-%H%M%S)"
288+
git checkout -b "$BRANCH_NAME"
289+
290+
git add content/glossary/
291+
git commit -m "Update glossary entries - $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
292+
293+
git push -u origin "$BRANCH_NAME"
294+
295+
gh pr create \
296+
--title "📘 Glossary update - $(date '+%Y-%m-%d')" \
297+
--body "Automated glossary update generated on $(date -u +'%Y-%m-%d %H:%M:%S UTC'). Files changed: content/glossary/" \
298+
--base master \
299+
--head "$BRANCH_NAME"
300+
echo "✅ PR created for glossary updates"
301+
env:
302+
GITHUB_TOKEN: ${{ secrets.FORRT_PAT }}
303+
GH_TOKEN: ${{ secrets.FORRT_PAT }}
304+
269305
#========================================
270306
# Download Google Analytics data and validate
271307
#========================================
272308
- name: Download GA Data
273309
id: ga-data
274310
continue-on-error: true # Continue even if this step fails
311+
if: |
312+
github.event_name == 'schedule' ||
313+
github.event.inputs.regenerate_ga == 'true'
275314
env:
276315
GA_API_CREDENTIALS: ${{ secrets.GA_API_CREDENTIALS }}
277316
GA_PROPERTY_ID: ${{ secrets.GA_PROPERTY_ID }}

0 commit comments

Comments
 (0)