Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 8, 2025

Action tests were failing on tag pushes (e.g., v1.0.0) because assertions hardcoded "main" as the expected tag for non-PR events.

Changes

  • Test assertions: Use github.ref_name dynamically and detect tags via github.ref.startsWith('refs/tags/')
    • __test-action-docker-build-image.yml
    • __test-action-get-image-metadata.yml
  • Documentation: Added CI testing strategy section to README.md explaining arrange-act-assert pattern and tag behavior
  • AGENTS.md: Reference new CI testing docs

Logic

// Before: hardcoded "main"
expectedTags.push("main");

// After: dynamic with tag detection
const refTag = `${{ github.ref_name }}`;
expectedTags.push(refTag);

const isTag = `${{ github.ref }}`.startsWith('refs/tags/');
const isPushOnDefaultBranch = `${{ github.event_name }}` === "push" && !isTag && refTag === "${{ github.event.repository.default_branch }}";

if (isPushOnDefaultBranch) {
  expectedTags.push("latest");
}

Result: Tests now expect correct tags for all contexts:

Original prompt

This section details on the original issue you should resolve

<issue_title>ci: fix action tests when running on tag pushes</issue_title>
<issue_description>CI jobs for testing our local GitHub Actions are currently failing whenever they run in a tag push context. The arrange/act/assert tests that cover our actions use assumptions tailored for branch pushes, so the assertions break on tag pushes.

Recent failing runs:

Tasks:

  • Update README.md to document how CI tests our local GitHub Actions: workflows are testing (arrange act assert) some local github actions.
  • Update AGENTS.md to reference the new README details.
  • Analyse the failing jobs and adjust the assertions so tests handle tag pushes correctly.
    </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.

Add documentation explaining how CI tests local GitHub Actions using arrange-act-assert patterns and how tests adapt to different trigger contexts (branch push, tag push, PR).

Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix action tests for tag push context ci: fix action tests for tag push events Nov 8, 2025
Copilot AI requested a review from neilime November 8, 2025 07:43
@neilime neilime marked this pull request as ready for review November 8, 2025 07:47
@neilime neilime merged commit c9559e3 into main Nov 8, 2025
93 of 97 checks passed
@neilime neilime deleted the copilot/fix-action-tests-tag-push branch November 8, 2025 10:17
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.

ci: fix action tests when running on tag pushes

2 participants