Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 1, 2026

The workflow timestamp check script was executing gh aw hash-frontmatter command to compute frontmatter hashes, which is not available in GitHub Actions runtime environments and caused workflow failures.

Changes

Replaced CLI execution with JavaScript implementation in check_workflow_timestamp_api.cjs:

  • Removed computeFrontmatterHashViaGo() function that executed gh aw hash-frontmatter
  • Now uses computeFrontmatterHash() from frontmatter_hash_pure.cjs with GitHub API file reader
  • Uses createGitHubFileReader() to fetch workflow files via GitHub API instead of requiring local filesystem access
  • Optimized hash computation to only run when timestamp check fails - hash computation now only executes when workflowDate > lockDate, avoiding unnecessary GitHub API calls when workflows are up to date
  • Updated tests to mock GitHub API responses instead of mocking exec commands

Before:

const exitCode = await exec.exec("gh", ["aw", "hash-frontmatter", workflowPath], {...});

After:

if (workflowDate > lockDate) {
  const fileReader = createGitHubFileReader(github, owner, repo, ref);
  const recomputedHash = await computeFrontmatterHash(workflowMdPath, { fileReader });
}

The new implementation uses pure JavaScript regex parsing to extract frontmatter hashes from lock files and compute hashes from workflow markdown files, eliminating the dependency on the gh aw CLI in GitHub Actions. Hash computation is now conditional and only runs when needed for debugging outdated lock files.

Testing

  • ✅ All 15 tests in check_workflow_timestamp_api.test.cjs pass
  • ✅ Full test suite passes: 3244 tests passed, 19 skipped
  • ✅ Code formatting and linting validated
Original prompt

Reference: https://github.com/githubnext/gh-aw/actions/runs/21571738910/job/62151901073#step:4:1

You can cannot use gh aw in this script. Review what it is being used and remove the usage. See report.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@pelikhan
Copy link
Contributor

pelikhan commented Feb 1, 2026

@copilot parse the frontmatter hash from the lock file using a JavaScript regex

@pelikhan
Copy link
Contributor

pelikhan commented Feb 1, 2026

@copilot reference is ok, it seems that the script tried to execute gh aw in a step which is wrong. Investigate step output and fix

Copilot AI changed the title [WIP] Remove gh aw usage from script Remove gh aw CLI references from GitHub Actions error messages Feb 1, 2026
Copilot AI requested a review from pelikhan February 1, 2026 23:09
Copy link
Contributor Author

Copilot AI commented Feb 1, 2026

@copilot parse the frontmatter hash from the lock file using a JavaScript regex

Done. Replaced the gh aw hash-frontmatter command execution with pure JavaScript regex parsing using computeFrontmatterHash() and createGitHubFileReader() from frontmatter_hash_pure.cjs. The hash is now extracted from the lock file using regex and computed from the workflow markdown file via GitHub API. (commit 317085d)

@copilot reference is ok, it seems that the script tried to execute gh aw in a step which is wrong. Investigate step output and fix

Fixed. The issue was in check_workflow_timestamp_api.cjs line 25 where it executed exec.exec("gh", ["aw", "hash-frontmatter", ...]). Replaced this with JavaScript implementation that fetches files via GitHub API and computes hashes using regex parsing. Error message references to gh aw compile have been reverted as they were correct. (commit 317085d)

Copilot AI changed the title Remove gh aw CLI references from GitHub Actions error messages Replace gh aw CLI execution with JavaScript hash computation in workflow validation Feb 1, 2026
@pelikhan
Copy link
Contributor

pelikhan commented Feb 1, 2026

@copilot only do frontmatter sha computation of timestamp check failed.

Copy link
Contributor Author

Copilot AI commented Feb 1, 2026

@copilot only do frontmatter sha computation of timestamp check failed.

Done. Moved the frontmatter hash computation inside the timestamp check failure condition. It now only runs when workflowDate > lockDate, avoiding unnecessary GitHub API calls when workflows are up to date. (commit c1506cb)

@pelikhan pelikhan marked this pull request as ready for review February 1, 2026 23:30
@pelikhan pelikhan merged commit 35effa8 into main Feb 1, 2026
83 checks passed
@pelikhan pelikhan deleted the copilot/remove-gh-aw-usage branch February 1, 2026 23:31
Copilot AI requested a review from pelikhan February 1, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants