feat: persist data/ to repository in GitHub Action workflow#43
Merged
unhappychoice merged 6 commits intomainfrom Apr 3, 2026
Merged
feat: persist data/ to repository in GitHub Action workflow#43unhappychoice merged 6 commits intomainfrom
unhappychoice merged 6 commits intomainfrom
Conversation
Add git commit & push steps after daily-fetch and weekly-fetch/generate so that accumulated events and report data survive between workflow runs. - Configure git user as github-weekly-reporter[bot] - Daily mode: commit data/ after event accumulation - Weekly mode: commit data/ after fetch + generate, then render and deploy - Skip commit when no changes (idempotent) The caller workflow must use actions/checkout before this action so the repository is available for git operations. Closes #33
Add 'date' input (YYYY-MM-DD) to the action. When provided, all commands target the week containing that date instead of the current week. This enables generating past week reports via workflow_dispatch.
The --date flag was parsed as UTC noon (T12:00:00Z), which could resolve to a different day in timezones far from UTC (e.g. Pacific/Kiritimati UTC+14). Now parseLocalDate() uses midnightInTz to find the correct UTC instant for noon of the given date in the user's configured timezone.
action.yml: - Set authenticated remote URL with token for reliable git push - Add git pull --rebase before push to handle concurrent runs - Add --date flag to deploy step - Document contents: write permission requirement Timezone fixes: - Add parseLocalDate() with input validation (YYYY-MM-DD regex) - Use parseLocalDate in all CLI commands instead of UTC noon hack - Fix formatDate in i18n to use parseLocalDate - Fix weekday helper to use timezone-aware day resolution - Add --date flag to deploy command Other: - Add data/, output/, tmp/ to .gitignore - Add 9 tests for parseLocalDate (various timezones, edge cases)
Write token to ~/.git-credentials and use git credential.helper store. This avoids token leakage in command-line arguments or step logs.
actions/checkout@v4 already configures git credentials via persist-credentials (default: true). No need to duplicate it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data/persists between workflow runsHow it works
Changes
git add data/ && git commit && git pushafter daily-fetchCaller workflow requirement
The workflow using this action must include
actions/checkoutbefore invoking:Closes #33