Adds week-level reporting to a GitHub Projects v2 board by filling missing opened and completed week fields. It is designed to be idempotent and does not overwrite existing project values.
-
Create or verify these Project v2 fields:
- Opened week: Text
- Completed week: Text
The legacy
Intake weekfield name is still supported as the opened-week target. -
Create a token:
- Preferred production option: GitHub App installation token with project read/write permissions.
- Simpler prototype option: classic PAT with
projectscope.
-
Add the repository secret:
PROJECTS_TOKEN
-
Run manually:
- Actions -> Sync project dates -> Run workflow
- Use
dry_run=truefirst.
-
Local development:
gh auth refresh -s project export ORG=taskcluster export PROJECT_NUMBER=23 export GH_TOKEN=$(gh auth token) DRY_RUN=true npm run sync
GitHub's documentation recommends a GitHub App for organization project automation, with a PAT as a simpler alternative for prototypes. See GitHub's docs for automating Projects using Actions and using the API to manage Projects.
- Does not overwrite existing values.
- Reads GitHub Projects' built-in
Createdfield for opened-week values. - Reads GitHub Projects' built-in
Closedfield for completed-week values. - Falls back to issue or pull request
createdAt/closedAtvalues if the built-in field value is absent. - Only updates text week fields.
- Uses UTC dates.
- Derives ISO week values as
YYYY-Www.
Environment variables:
ORG=taskcluster
PROJECT_NUMBER=23
GH_TOKEN=...
DRY_RUN=false
VERBOSE=false- v1 does not create project fields.
- v1 assumes project item
fieldValuesfit within the first 100 values. - v1 only fills
Completed weekwhen GitHub has a closed date. - v1 does not clear week fields when issues are reopened.
- Missing token: set
GH_TOKENlocally or configure thePROJECTS_TOKENrepository secret for Actions. - Invalid authorization header: recreate
PROJECTS_TOKENwith the raw token value only. Do not include quotes,Bearer,token, a private key, JSON, or trailing newlines. - Missing project fields: create
Opened weekandCompleted weekas Text fields. - Token lacks project scope: refresh or replace the token with organization project read/write permissions.
npm test
DRY_RUN=true npm run sync