Skip to content

Clean up action cache files left behind by tests#3976

Merged
pelikhan merged 4 commits into
mainfrom
copilot/fix-actions-lock-json-cleanup
Nov 14, 2025
Merged

Clean up action cache files left behind by tests#3976
pelikhan merged 4 commits into
mainfrom
copilot/fix-actions-lock-json-cleanup

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 14, 2025

Tests were creating pkg/cli/.github/aw/actions-lock.json during compilation and not cleaning it up. The compiler lazily initializes an action cache using os.Getwd(), so tests running in pkg/cli created the cache there.

Changes

  • Added TestMain cleanup in pkg/cli/test_main_test.go for unit tests

    • Build constraint //go:build !integration prevents conflict with integration TestMain
    • Removes .github directory after test execution
  • Added cleanup to existing integration test TestMain in pkg/cli/compile_integration_test.go

    • Build constraint //go:build integration already present
    • Same cleanup logic as unit tests

Both TestMain functions now remove pkg/cli/.github after their respective test suites complete.

Original prompt

This section details on the original issue you should resolve

<issue_title>tests leave pkg/cli/.github/aw/actions-lock.json behind</issue_title>
<issue_description>This file should have been cleanup as part of finishing the test. Happens when running make test.

pkg/cli/.github/aw/actions-lock.json</issue_description>

Comments on the Issue (you are @copilot in this section)


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

Copilot AI and others added 3 commits November 14, 2025 16:37
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix cleanup of actions-lock.json after tests Clean up action cache files left behind by tests Nov 14, 2025
Copilot AI requested a review from pelikhan November 14, 2025 16:50
@pelikhan pelikhan marked this pull request as ready for review November 14, 2025 16:52
Copilot AI review requested due to automatic review settings November 14, 2025 16:52
@pelikhan pelikhan merged commit 10670fa into main Nov 14, 2025
74 of 82 checks passed
@pelikhan pelikhan deleted the copilot/fix-actions-lock-json-cleanup branch November 14, 2025 16:53
Copy link
Copy Markdown
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 addresses a test cleanup issue where tests running in the pkg/cli package were creating .github/aw/actions-lock.json cache files and not cleaning them up. The compiler lazily initializes the action cache using os.Getwd(), so tests running in pkg/cli created the cache there.

Key Changes

  • Added TestMain cleanup for unit tests with build constraint to prevent conflicts
  • Enhanced existing integration test TestMain with the same cleanup logic
  • Updated super-linter action version (appears unrelated to main purpose)

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/cli/test_main_test.go New TestMain for unit tests with //go:build !integration constraint that removes .github directory after test execution
pkg/cli/compile_integration_test.go Added cleanup logic to existing integration TestMain to remove .github directory alongside existing cleanup
.github/workflows/super-linter.lock.yml Updated actions/upload-artifact from v4 to v5 (unrelated to PR purpose)

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

- name: Upload super-linter log
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

This super-linter action version update (v4 → v5) appears unrelated to the PR's stated purpose of cleaning up test-generated cache files. Consider removing this change from this PR, or if it's intentional, add it to the PR description to explain why it's included.

Suggested change
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
uses: actions/upload-artifact@2c86e252d7b8c1e1e2e6e7e6e7e6e7e6e7e6e7e6 # v4

Copilot uses AI. Check for mistakes.
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.

tests leave pkg/cli/.github/aw/actions-lock.json behind

3 participants