Skip to content

Make cross-language hash validation test robust by computing hash dynamically#15776

Merged
pelikhan merged 4 commits intomainfrom
copilot/fix-github-actions-workflow-5a56aa32-a52f-4df5-a7df-a6bfb891cd71
Feb 14, 2026
Merged

Make cross-language hash validation test robust by computing hash dynamically#15776
pelikhan merged 4 commits intomainfrom
copilot/fix-github-actions-workflow-5a56aa32-a52f-4df5-a7df-a6bfb891cd71

Conversation

Copy link
Contributor

Copilot AI commented Feb 14, 2026

The frontmatter_hash_github_api.test.cjs cross-language validation test was failing because the hardcoded expected hash no longer matched the computed hash from both Go and JavaScript implementations.

Changes

  • Modified actions/setup/js/frontmatter_hash_github_api.test.cjs to dynamically compute the expected hash by running the Go test implementation
  • The test now executes go test -run TestHashWithRealWorkflow ./pkg/parser/ and extracts the hash from the output
  • Eliminated hardcoded hash value that required manual updates when workflow files changed

Implementation

The test now uses execSync to run the Go test and extract the hash dynamically:

// Dynamically compute the hash using Go implementation
const { execSync } = await import("child_process");
const goTestOutput = execSync("go test -v -run TestHashWithRealWorkflow ./pkg/parser/", {
  cwd: repoRoot,
  encoding: "utf8",
});

// Extract hash from Go test output
const hashMatch = goTestOutput.match(/Hash for audit-workflows\.md:\s+([a-f0-9]{64})/);
const goHash = hashMatch[1];

// Verify JavaScript hash matches Go hash
expect(jsHash).toBe(goHash);

Benefits

  • Eliminates maintenance burden: No more manual updates to hardcoded hash values when workflow files change
  • True cross-language validation: Both implementations compute fresh hashes for comparison
  • Robust against file changes: Test remains valid regardless of workflow file modifications
Original prompt

Fix the failing GitHub Actions workflow js
Analyze the workflow logs, identify the root cause of the failure, and implement a fix.
Job ID: 63637164758
Job URL: https://github.com/github/gh-aw/actions/runs/22023824060/job/63637164758


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot fix test to recompute the hash both with Go and Javascript so that the hardcoded value does not get invalidated on each build.

Copilot AI changed the title [WIP] Fix failing GitHub Actions workflow js Fix cross-language hash validation test after workflow file changes Feb 14, 2026
Copilot AI requested a review from pelikhan February 14, 2026 20:54
…value

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 14, 2026

@copilot fix test to recompute the hash both with Go and Javascript so that the hardcoded value does not get invalidated on each build.

Updated the test to dynamically compute the hash from both Go and JavaScript implementations. The test now runs go test -run TestHashWithRealWorkflow to extract the Go hash and compares it with the JavaScript computed hash, eliminating the hardcoded value.

Commit: 9433571

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Fix cross-language hash validation test after workflow file changes Make cross-language hash validation test robust by computing hash dynamically Feb 14, 2026
@pelikhan pelikhan marked this pull request as ready for review February 14, 2026 21:04
Copilot AI review requested due to automatic review settings February 14, 2026 21:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a failing cross-language hash validation test by replacing a hardcoded expected hash value with dynamic computation from the Go reference implementation. This eliminates the maintenance burden of manually updating hash values whenever workflow files change and ensures robust cross-language validation.

Changes:

  • Modified the cross-language validation test in frontmatter_hash_github_api.test.cjs to dynamically execute the Go test implementation and extract the hash from its output
  • Replaced hardcoded hash value with dynamic execution using execSync to run go test -run TestHashWithRealWorkflow
  • Enhanced logging to show both JavaScript and Go computed hashes for better debugging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 0db4d1a into main Feb 14, 2026
56 of 58 checks passed
@pelikhan pelikhan deleted the copilot/fix-github-actions-workflow-5a56aa32-a52f-4df5-a7df-a6bfb891cd71 branch February 14, 2026 21:09
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