Skip to content

fix: make action publication workflow dispatchable#14

Merged
kantorcodes merged 1 commit intomainfrom
feat/action-marketplace-bootstrap
Mar 30, 2026
Merged

fix: make action publication workflow dispatchable#14
kantorcodes merged 1 commit intomainfrom
feat/action-marketplace-bootstrap

Conversation

@kantorcodes
Copy link
Copy Markdown
Member

@kantorcodes kantorcodes commented Mar 30, 2026

Summary

  • remove the invalid job-level secrets expression from the action publication workflow
  • validate ACTION_REPO_TOKEN inside the job so workflow dispatches succeed
  • add regression coverage for the dispatch-safe workflow shape

Verification

  • .venv/bin/python -m pytest tests/test_action_bundle.py -q
  • .venv/bin/python -m pytest -q
  • .venv/bin/python -m build

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot bot commented Mar 30, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Overview

This PR correctly fixes an invalid job-level secrets expression in the GitHub Actions workflow. In GitHub Actions, secrets context is not available in job-level if conditions — it silently evaluates to an empty string, causing the job to always run regardless of whether the secret is configured. Moving the validation into a step with if [ -z "${GH_TOKEN}" ] is the correct approach.

Files Reviewed (2 files)
  • .github/workflows/publish-action-repo.yml - Removed invalid job-level if, added step-level credential validation
  • tests/test_action_bundle.py - Added regression assertions to verify the fix

Reviewed by mimo-v2-pro-20260318 · 61,323 tokens

@kantorcodes kantorcodes merged commit 374600d into main Mar 30, 2026
18 checks passed
@kantorcodes kantorcodes deleted the feat/action-marketplace-bootstrap branch March 30, 2026 16:52
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates tests/test_action_bundle.py to include assertions for credential validation and the removal of a conditional check within the workflow text. The review feedback suggests refactoring these tests to use a YAML parser instead of string matching to improve resilience against formatting changes and ensure more precise structural validation.

Comment on lines +37 to +38
assert "Validate publication credentials" in workflow_text
assert 'if: secrets.ACTION_REPO_TOKEN != \'\'' not in workflow_text
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

These new assertions highlight a general issue with this test function: checking for string presence in a structured file like YAML is brittle. For instance, the checks could pass if the string is present in a comment, or fail on benign formatting changes.

A more robust approach is to parse the YAML file and inspect its structure. This makes the test more precise and resilient to formatting changes.

Consider refactoring this test to use a YAML parser (e.g., PyYAML, which would need to be added to test dependencies).

Here's an example of how you could rewrite some of the checks:

import yaml

# In test_publish_action_repo_workflow_syncs_action_repository:
workflow_path = ROOT / ".github" / "workflows" / "publish-action-repo.yml"
workflow_data = yaml.safe_load(workflow_path.read_text(encoding="utf-8"))

# Check workflow name
assert workflow_data["name"] == "Publish GitHub Action Repository"

# Check that the job-level 'if' is removed
# This assumes the job is named 'publish'. Adjust if necessary.
publish_job = workflow_data["jobs"]["publish"]
assert "if" not in publish_job

# Check for the new validation step
step_names = [step.get("name") for step in publish_job["steps"]]
assert "Validate publication credentials" in step_names

# Check for specific commands
all_steps_run_commands = ' '.join([step.get('run', '') for step in publish_job['steps']])
assert 'gh repo create "${ACTION_REPOSITORY}"' in all_steps_run_commands

Applying this pattern to all assertions in this test would significantly improve its maintainability and reliability.

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.

1 participant