From 9e30f7fc5b4dc873f5543d042ada502c33f85b20 Mon Sep 17 00:00:00 2001 From: soyalejolopez <88358406+soyalejolopez@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:01:18 -0500 Subject: [PATCH] Pause GitHub repository traffic collection The step needs a token with Administration read access, which organization policy expires every few days, so it failed daily and kept issue #482 open. It now runs only when the COLLECT_GITHUB_TRAFFIC repository variable is true and otherwise emits a notice. Clarity and vote collection, staging, and the weekly pull request are unchanged, and the workflow test now models a skipped step. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/traffic-stats.yml | 9 ++++++++ CHANGELOG.md | 2 +- tools/catalog-build/test-traffic-workflow.js | 23 ++++++++++++++------ traffic-data/README.md | 9 +++++++- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/traffic-stats.yml b/.github/workflows/traffic-stats.yml index 13a6796d..669fce0f 100644 --- a/.github/workflows/traffic-stats.yml +++ b/.github/workflows/traffic-stats.yml @@ -91,8 +91,13 @@ jobs: run: npm ci working-directory: tools/catalog-build + # GitHub repository traffic (views, clones, referrers) is paused: it needs a token that + # expires every few days under organization policy, and the site's page analytics come + # from Clarity. Set the repository variable COLLECT_GITHUB_TRAFFIC to "true" and replace + # the TRAFFIC_TOKEN secret to resume. - name: Collect and persist GitHub traffic data id: github-traffic + if: ${{ vars.COLLECT_GITHUB_TRAFFIC == 'true' }} continue-on-error: true env: GH_TOKEN: ${{ secrets.TRAFFIC_TOKEN }} @@ -272,6 +277,10 @@ jobs: echo "✅ Saved $DATA_DIR/$DATE.json" + - name: Note that GitHub traffic collection is paused + if: ${{ vars.COLLECT_GITHUB_TRAFFIC != 'true' }} + run: echo "::notice::GitHub repository traffic collection is paused. Page analytics come from Clarity. To resume, set the repository variable COLLECT_GITHUB_TRAFFIC to true and replace the TRAFFIC_TOKEN secret." + - name: Build resource stats id: stats if: always() diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b432e5c..f4210c8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,7 @@ This file captures only selected high-level milestones. * Added a shareable page for every resource; archived resources are now hidden by default; added an Agent 365 highlight row (driven by the `agent-365` tag) and "New" badges to the landing page. * Cataloged 23 previously unlisted scripts, snippets, and samples (Viva Engage administration, Teams Phone and Rooms, SimpleGraph, ESS extensions) and archived scripts that depend on retired modules or services. * Archived the prompt samples and removed a 41 MB archived demo video. -* Added issue forms, a refreshed pull request template, and a manual traffic collection command. +* The daily **Collect Traffic Data** workflow no longer collects GitHub repository traffic (views, clones, referrers), which needs a token that expires every few days under organization policy. It skips that step with a notice and keeps collecting Clarity page analytics and discussion votes. Set the repository variable `COLLECT_GITHUB_TRAFFIC` to `true` and replace `TRAFFIC_TOKEN` to resume. ### April 20, 2018 diff --git a/tools/catalog-build/test-traffic-workflow.js b/tools/catalog-build/test-traffic-workflow.js index 5006e3f5..1ccf10f4 100644 --- a/tools/catalog-build/test-traffic-workflow.js +++ b/tools/catalog-build/test-traffic-workflow.js @@ -64,6 +64,11 @@ assert(hasUnsafeConflict(['resource-stats.json', 'traffic-data/2026-09-14.json'] 'A mixed conflict set must stop synchronization instead of overwriting source data.'); assert(githubTraffic?.['continue-on-error'] === true, 'GitHub traffic failure must not block the independent Clarity source.'); +assert(githubTraffic?.if?.includes("vars.COLLECT_GITHUB_TRAFFIC == 'true'"), + 'GitHub traffic collection must run only when the COLLECT_GITHUB_TRAFFIC repository variable is true.'); +const pauseNote = collectSteps.find(step => step.name === 'Note that GitHub traffic collection is paused'); +assert(pauseNote?.if?.includes("vars.COLLECT_GITHUB_TRAFFIC != 'true'") && pauseNote.run.includes('::notice::') && !pauseNote.run.includes('::error::'), + 'A paused GitHub traffic collection must say so as a notice, never as an error.'); assert(stats?.['continue-on-error'] === true && stats.run.includes('--require-clarity'), 'Clarity must report unavailability without blocking a healthy GitHub snapshot.'); assert(stats?.if === 'always()', 'Stats must run even when GitHub traffic collection fails.'); @@ -87,8 +92,8 @@ assert(persist.run.includes('if [ "${{ steps.stats.outputs.generated }}" = "true function evaluateCondition(expression, state) { const replacements = new Map([ ['always()', true], - ["steps.github-traffic.outcome == 'success'", state.github], - ["steps.github-traffic.outcome == 'failure'", !state.github], + ["steps.github-traffic.outcome == 'success'", state.github === 'success'], + ["steps.github-traffic.outcome == 'failure'", state.github === 'failure'], ["steps.stats.outputs.clarity_available == 'true'", state.clarity], ["steps.stats.outcome == 'failure'", !state.clarity], ["steps.persist.outcome == 'failure'", state.persistFailed] @@ -101,11 +106,15 @@ function evaluateCondition(expression, state) { } const combinations = [ - { github: true, clarity: true, persistFailed: false, persist: true, fail: false }, - { github: true, clarity: false, persistFailed: false, persist: true, fail: true }, - { github: false, clarity: true, persistFailed: false, persist: true, fail: true }, - { github: false, clarity: false, persistFailed: false, persist: false, fail: true }, - { github: true, clarity: true, persistFailed: true, persist: true, fail: true } + { github: 'success', clarity: true, persistFailed: false, persist: true, fail: false }, + { github: 'success', clarity: false, persistFailed: false, persist: true, fail: true }, + { github: 'failure', clarity: true, persistFailed: false, persist: true, fail: true }, + { github: 'failure', clarity: false, persistFailed: false, persist: false, fail: true }, + { github: 'success', clarity: true, persistFailed: true, persist: true, fail: true }, + // Paused GitHub traffic: Clarity alone keeps the run green and persisted. + { github: 'skipped', clarity: true, persistFailed: false, persist: true, fail: false }, + { github: 'skipped', clarity: false, persistFailed: false, persist: false, fail: true }, + { github: 'skipped', clarity: true, persistFailed: true, persist: true, fail: true } ]; for (const combination of combinations) { diff --git a/traffic-data/README.md b/traffic-data/README.md index 05acae1e..b55b7e45 100644 --- a/traffic-data/README.md +++ b/traffic-data/README.md @@ -5,7 +5,8 @@ Daily collection is committed to the durable `automation/traffic-stats-staging` branch so Clarity's three-day export window is preserved without daily pull requests. **Files:** -- `YYYY-MM-DD.json` — Full daily snapshot (views, clones, referrers, popular paths) +- `YYYY-MM-DD.json` — Full daily snapshot (views, clones, referrers, popular paths). Collection of these is paused; see below. +- `clarity-views.json` — Accumulated Clarity page views per resource, the source of the view counts on the site. Data is collected daily at 06:00 UTC via GitHub Actions. Each Friday at 08:00 `America/Chicago` (including daylight saving time), the workflow updates one @@ -15,6 +16,12 @@ open weekly review. If the optional `AUTOMATION_PAT` is not configured or cannot create pull requests, the workflow prints a manual compare URL; daily collection continues safely on the staging branch. +## GitHub repository traffic is paused + +Since 2026-10-29 the workflow no longer collects GitHub's repository traffic (views, clones, referrers, popular paths, stars and forks). That API needs a token with Administration read access, and organization policy limits fine-grained tokens to a few days, so the daily run failed and the alert issue stayed open. Page analytics for the catalog come from Clarity, which the workflow still collects every day, along with discussion votes. The daily run skips the GitHub step with a notice and stays green. + +To resume, create a token that meets the organization's policy, save it as the `TRAFFIC_TOKEN` secret, and set the repository variable `COLLECT_GITHUB_TRAFFIC` to `true` (Settings, Secrets and variables, Actions, Variables). The next run collects again. GitHub keeps only 14 days, so anything not collected while paused is gone. + ## Manual collection When the scheduled workflow cannot authenticate (for example, its `TRAFFIC_TOKEN` expired), collect a snapshot by hand. GitHub keeps only a rolling 14 days of traffic, so run this at least every two weeks to avoid gaps. Each snapshot overlaps the previous one, and analysis unions days by date, so extra runs never double count.