Skip to content

feat(workflows): host the reusable GitHub workflows in this repo - #120

Draft
metalwarrior665 wants to merge 2 commits into
masterfrom
claude/repo-merge-actions-package-ep3lzw
Draft

feat(workflows): host the reusable GitHub workflows in this repo#120
metalwarrior665 wants to merge 2 commits into
masterfrom
claude/repo-merge-actions-package-ep3lzw

Conversation

@metalwarrior665

Copy link
Copy Markdown
Member

This PR introduces a complete set of reusable GitHub workflows and supporting infrastructure that consumer repositories can use for testing, building, and releasing their Actors.

Summary

The package now includes production-ready reusable workflows alongside the CLI, enabling consumer repos to standardize their CI/CD pipelines. These workflows handle platform testing, PR validation, releases, and Claude-powered automated investigation and fixes for failing tests.

Key Changes

  • Reusable Workflows (.github/workflows/):

    • pr-build-test.yaml: Runs unit tests and platform tests on pull requests
    • platform-tests.yaml: Scheduled platform test runs with Slack reporting
    • push-build-latest.yaml: Builds and releases Actors on master push
    • claude.yaml: Responds to @claude mentions to implement fixes via Claude Code
    • platform-tests-claude-investigate-and-fix.yaml: Two-phase workflow that uses Claude to investigate failing tests and automatically open issues and PRs
    • _move_major_tag.yaml: Manages the floating @v1 tag, only moving it when the required package version is published
    • manual_move_major_tag.yaml: Escape hatch for manual tag management
  • GitHub Actions (.github/actions/):

    • checkout-restore-dependencies/action.yaml: Composite action for checkout, Node setup, and dependency caching with npm token isolation
  • Helper Scripts (.github/scripts/):

    • run-with-apify-tokens.mjs: Securely passes only required Actor tokens to CLI commands, preventing secret leakage to node_modules
  • Configuration:

    • .github/workflows-min-package-version: Declares the minimum CLI version required by the workflows, gating tag movement until that version is published
  • Documentation:

    • Updated README.md with workflow usage examples, secret handling details, and versioning guidance
    • Updated CONTRIBUTING.md to document the workflows as a third component of the package

Notable Implementation Details

  • Secret Isolation: Secrets are passed only to the steps that need them, never as job-wide environment variables. The run-with-apify-tokens.mjs script reads apify-test-tools.config.json to determine which Actor tokens to pass, preventing accidental exposure.

  • Versioning Strategy: Consumer repos pin workflows to @v1 (a floating major tag), not @master. The tag only moves when the declared minimum package version is published on npm, preventing workflows from calling unreleased CLI features.

  • Claude Integration: The platform-tests-claude-investigate-and-fix.yaml workflow chains investigation and fix phases as job dependencies rather than label triggers, working around GitHub's limitation that scheduled runs cannot trigger other workflows.

  • Backward Compatibility: The platform-tests.yaml workflow supports both the deprecated subtest input and the new test-files-glob input for gradual migration.

https://claude.ai/code/session_01SkUZADZ6gzWW4GE6CFMreM

Moves the contents of apify-store/github-actions-source here, so a change that
spans a CLI feature and the workflow calling it is one PR against one branch
instead of two repos with a manual ref dance between them.

Consumers pin the `@v1` major tag rather than `@master`, and the setup action
installs `apify-test-tools@>=<floor>` (from .github/workflows-min-package-version)
instead of `@latest`. That resolves to the same newest stable in the normal case,
but makes a workflow's package requirement explicit.

The release cadences stay independent, because most changes only touch one side:

- workflow-only change: merge, `v1` moves, live, no npm release
- package-only change: merge and release when ready, workflows untouched
- workflow calling a new CLI feature: raise the floor in the same PR. On merge the
  `v1` move is held with a warning until that version is on npm, so consumers keep
  running the previous workflows instead of calling a CLI that doesn't exist yet.
  A stable release moves the tag; `manual_move_major_tag` is the escape hatch.

Also:
- run-with-apify-tokens.mjs moves to .github/scripts/, next to the other CI helper
  and out of eslint's path; the action's `scripts-path` output follows it
- pass github.head_ref/base_ref through the environment in pr-build-test, since
  branch names are attacker-controlled on fork PRs and actionlint gates master here
- prettier formatting on the imported files, which husky enforces here

Refs in the consumer snippets in the README were still `@new_master` and are
updated along with the repo path.
@metalwarrior665 metalwarrior665 changed the title Add reusable GitHub workflows and Claude integration feat(workflows): host the reusable GitHub workflows in this repo Aug 20, 2026
actionlint gates master here and the action wrapper runs shellcheck, which the
old repo's CI did not, so this SC2086 came in with the import. Unquoted it would
word-split if the runner ever pointed $GITHUB_OUTPUT at a path with spaces.
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