From c338b4ef7912508b27dabef8f016ef4be796d186 Mon Sep 17 00:00:00 2001 From: Rundeck CI Date: Mon, 31 Aug 2026 09:21:21 -0700 Subject: [PATCH] Fix workflow YAML broken by an applied Copilot Autofix suggestion The 'Potential fix for pull request finding' commit (833450a) that got applied directly to main broke two things: 1. Two lines landed at column 0 inside a `run: |` block, breaking YAML indentation. GitHub couldn't parse the file at all as a result - which is why workflow_dispatch stopped showing up for manual runs (gh workflow list fell back to showing the raw filename instead of the workflow's name:, the tell that parsing had failed). 2. It dropped `git add pr-tracking/` entirely. Even with the YAML fixed, the commit step would have nothing staged - the workflow would silently stop committing anything, ever, including all the history files, not just latest.md. The underlying concern the autofix was reaching for - avoiding a second, possibly UTC-midnight-inconsistent `date +%Y-%m-%d` call across steps - was legitimate. Implemented it properly instead: the first step computes $today once and shares it via $GITHUB_ENV; later steps read it rather than recomputing (or globbing for it by file mtime, which has its own edge cases). --- .github/workflows/pr-tracking-workflow.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-tracking-workflow.yml b/.github/workflows/pr-tracking-workflow.yml index cf3e729..22a9f6b 100644 --- a/.github/workflows/pr-tracking-workflow.yml +++ b/.github/workflows/pr-tracking-workflow.yml @@ -184,6 +184,12 @@ jobs: # Check if today's entry already exists, update or append today=$(date +%Y-%m-%d) + # Share this exact value with later steps via $GITHUB_ENV instead + # of letting them recompute their own `date` call - each `run:` + # block is a fresh shell, so a later step's `date +%Y-%m-%d` could + # in principle disagree with this one if the job happened to + # straddle a UTC midnight between steps. + echo "today=$today" >> "$GITHUB_ENV" if grep -q "^$today," pr-tracking/history.csv; then # Update existing entry - remove old line and append new grep -v "^$today," pr-tracking/history.csv > pr-tracking/history.csv.tmp @@ -223,7 +229,9 @@ jobs: # already writes, so there's one report to read. # continue-on-error above means a bug here can't take down the daily # PR report that already ran and was written to disk. - today=$(date +%Y-%m-%d) + # $today comes from $GITHUB_ENV (set in the step above) rather + # than a fresh `date` call, so this step's appends always land on + # the exact same file that step wrote to. # Scoped to repos tagged with the "versioned-plugins" GitHub topic - # real plugins we cut releases for on a regular cadence, not tooling/ # example/demo repos that happen to carry semver tags for their own @@ -297,7 +305,10 @@ jobs: # copying earlier (e.g. right after pr-count.md is written) # would miss whatever that step appends to $today.md. History is # unaffected; pr-tracking/$today.md still exists for every day. -latest_report=$(ls -1t pr-tracking/[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].md | head -n 1) -cp "$latest_report" pr-tracking/latest.md - git commit -m "Daily PR report: $(date +%Y-%m-%d)" || echo "No changes" + # $today comes from $GITHUB_ENV (set in the first step) rather + # than a fresh `date` call or a filesystem-mtime glob, so this is + # guaranteed to be the exact file the earlier steps wrote to. + cp "pr-tracking/$today.md" pr-tracking/latest.md + git add pr-tracking/ + git commit -m "Daily PR report: $today" || echo "No changes" git push origin pr-tracking