Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/time-tracking.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Keeps the `Spent (h)` project field in sync with `/time` comments, and posts the weekly report.
# Keeps the `Spent (h)` project field in sync with `/time` comments, and writes the weekly report to the run summary.
# Needs the secret PROJECTS_TOKEN: a token that can write to the organization's projects and read its repositories
# (fine-grained PAT or GitHub App token; the default GITHUB_TOKEN cannot write organization projects).
name: time-tracking
Expand All @@ -11,7 +11,6 @@ on:

permissions:
contents: read
issues: write

jobs:
sync:
Expand All @@ -29,15 +28,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Post the report on the "Time reports" issue
- name: Weekly report
env:
GH_TOKEN: ${{ secrets.PROJECTS_TOKEN }}
run: |
set -euo pipefail
until=$(date -u -d 'yesterday' +%F)
since=$(date -u -d '7 days ago' +%F)
python3 -I scripts/time_tracking.py report phorge-fr --since "$since" --until "$until" --out report.md
issue=$(gh issue list --repo phorge-fr/.github --state open --search 'Time reports in:title' --json number,title \
--jq '[.[]|select(.title=="all/time: Time reports")][0].number // empty')
[ -n "$issue" ] || { echo "::error::Create the issue titled 'all/time: Time reports' first."; exit 1; }
gh issue comment "$issue" --repo phorge-fr/.github --body-file report.md
cat report.md >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: time-report
path: report.md
retention-days: 90
2 changes: 1 addition & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ GitHub has no native time tracking, so Phorge uses a comment convention.
- Write it on the issue or the pull request the time was spent on. One command per line; several per comment are fine.
- Units: `h` and `m`, combined (`1h30`, `1h 30m`, `90m`). Default date is the comment's.
- The `time-tracking` workflow runs hourly and sums the entries of each item into the `Spent (h)` field of its project items.
- Every Monday a report (per day, per author, per issue and per pull request) is posted as a comment on the issue `all/time: Time reports` in this repository. `scripts/time_tracking.py report phorge-fr` produces it on demand.
- Every Monday a report (per day, per author, per issue and per pull request) is in the summary of the `time-tracking` workflow run and kept as the `time-report` artifact for 90 days; nothing is posted on an issue. `scripts/time_tracking.py report phorge-fr` produces it on demand.
- Edit or delete a wrong comment; totals are recomputed.

## Milestones and roadmaps
Expand Down
Loading