Skip to content

Generate Daily Changelog #4

Generate Daily Changelog

Generate Daily Changelog #4

Workflow file for this run

name: Generate Daily Changelog
on:
schedule:
# Run daily at 00:00 UTC
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
since:
description: 'Start date (YYYY-MM-DD, optional)'
required: false
type: string
permissions:
contents: write
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for git log
token: ${{ secrets.GH_PAT || github.token }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Generate git changelog
run: |
if [ -n "${{ inputs.since }}" ]; then
node scripts/generate-changelog.js --since "${{ inputs.since }}"
else
# Default: last 7 days
SINCE=$(date -d '7 days ago' +%Y-%m-%d)
node scripts/generate-changelog.js --since "$SINCE"
fi
- name: Fetch GitHub issue activity
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
if [ -n "${{ secrets.GH_PAT }}" ]; then
if [ -n "${{ inputs.since }}" ]; then
node scripts/fetch-issue-activity.js --since "${{ inputs.since }}"
else
# Default: yesterday
node scripts/fetch-issue-activity.js
fi
else
echo "⚠️ GH_PAT not set, skipping issue activity fetch"
echo " Add GH_PAT secret to enable issue/PR tracking"
fi
- name: Check for changes
id: check
run: |
# Only check for .jsonl files (new format)
if [ -n "$(git status --porcelain codex-history/*.jsonl 2>/dev/null)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push
if: steps.check.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Only add .jsonl files (ignore old .json files if any)
git add codex-history/*.jsonl
DATE=$(date +%Y-%m-%d)
MONTH=$(date +%Y-%m)
git commit -m "chore(changelog): append history for ${DATE} to ${MONTH}.jsonl"
git push origin master
- name: No changes
if: steps.check.outputs.has_changes == 'false'
run: echo "✅ No new activity to record (all dates already exist or no commits/activity)"