diff --git a/.github/workflows/time-tracking.yml b/.github/workflows/time-tracking.yml index d8b0ebf..0b84457 100644 --- a/.github/workflows/time-tracking.yml +++ b/.github/workflows/time-tracking.yml @@ -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 @@ -11,7 +11,6 @@ on: permissions: contents: read - issues: write jobs: sync: @@ -29,7 +28,7 @@ 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: | @@ -37,7 +36,9 @@ jobs: 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 diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 4a4a222..49ab697 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -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