Skip to content

[r5n-83] actions command#7

Merged
ice-chillios merged 38 commits into
developfrom
r5n-83-actions-command
Mar 24, 2026
Merged

[r5n-83] actions command#7
ice-chillios merged 38 commits into
developfrom
r5n-83-actions-command

Conversation

@deralaxo

@deralaxo deralaxo commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Add sis actions command for CI/CD automation and cross-platform git provider support (GitHub + GitLab).

New Commands

sis actions init - Generate CI workflows for automated releases

  • Auto-detects git provider (GitHub/GitLab) from remote URL
  • Interactive workflow selection or use --all flag
  • Available workflows:
    • create-stone - Auto-create stone when PR is merged, then create/update release PR
    • release - Publish packages when release PR is merged
  • GitHub: Creates individual files in .github/workflows/
  • GitLab: Creates .gitlab-ci-sisyphus.yml with include directive instructions

sis actions release-pr - Create or update a release PR from pending stones

  • Auto-generates stones from conventional commits since last release
  • Merges all pending stones into a single release
  • Creates sisyphus/release branch with version bumps and changelogs
  • Archives stones to released/<timestamp>/ directory
  • Creates/updates PR with sisyphus-release label
  • Stores release metadata in currentRelease config for publish-only mode
  • Designed to run in CI after PRs are merged

sis roll --publishOnly - Publish from prepared release (no file changes)

  • Reads package versions from currentRelease config
  • Creates git tags, publishes to NPM, creates git release
  • Clears currentRelease after successful publish
  • Designed for two-stage CI: prepare on PR merge, publish on release PR merge

GitProvider Abstraction

  • Abstract GitProvider base class with implementations for:
    • GitHubProvider - Full gh CLI integration (PRs, labels, releases)
    • GitLabProvider - Full glab CLI integration (MRs, labels, releases)
    • BitbucketProvider - Stub (not yet implemented)
  • Auto-detection via detectProvider() based on remote URL
  • Commit author uses r5n-bot[bot] for CI operations

Skip Rules

pr.skip - Skip stone creation for specific PRs:

  • labels - Skip PRs with specific labels (default: sisyphus-release, skip-stone)
  • authors - Skip PRs by specific authors (default: r5n-bot[bot])
  • titlePatterns - Skip PRs matching title regex (default: ^chore\(release\):)

commits.skip - Skip commits when auto-generating stones:

  • authors - Skip commits by specific authors (default: r5n-bot[bot])
  • messagePatterns - Skip commits matching regex (default: ^chore\(release\):, ^chore: add stone)

Changelog Improvements

  • Configurable headers: packageHeader and rootHeader templates
  • Package-specific release notes filtered by affected packages
  • Collapsible format for detailed changes

Bug Fixes

  • Single-package repos - sis pr now correctly detects affected packages
  • Exit codes - CLI now exits with code 1 on errors, 0 on Cancel/Exit
  • Error visibility - Critical git/API errors are now shown (removed excessive .quiet())

Breaking Changes

  • Config: release.githubrelease.createRelease
  • CLI: sis roll --githubsis roll --createRelease / -r

New Domain Helpers

  • Stone.mergeAll() - Merge multiple stones into one
  • Stone.fromJson() - Deserialize archived stones
  • Package.applyStone() - Apply stone bumps to packages
  • Package.withVersions() - Set old/new versions explicitly
  • Commit.fromHash() - Fetch single commit by hash
  • Commit.fromMerge() - Get commits from a merge commit
  • CommitAnalyzer.buildStoneData() - Convert commit group to stone data

@linear

linear Bot commented Mar 11, 2026

Copy link
Copy Markdown
R5N-83 [SIS] `actions` command

This command will create workflows that use baked-in actions for example:

sis actions check-stones (or whatever better name for this flow)

Automated Release PR Creation (like changesets/action)
When stones are committed to the repo, a workflow runs this command that creates/updates a "Release PR". The PR contains version bumps, changelog updates

Merging the PR triggers the actual release

Also it could make actions that:

  • after merging automatically run sis pr on that PR and commit the stone
    this of course would trigger the other workflow described above
  • after the merge of the Release PR would automatically run the actual sis roll command

Sisyphus GitHub Actions Release Flow

Overview

Automated release workflow using GitHub Actions with a two-stage process: Release PR(prepares changes) and Publish (releases to npm/GitHub).

Directory Structure

.sisyphus/
  stones/                       # Pending stones (unreleased changes)
  released/
    2026-03-11T14-30-00Z/       # Archived stones per release (UTC)
      abc123.yaml
      def456.yaml
    2026-03-15T09-00-00Z/
      ghi789.yaml
  config.json                   # Includes currentRelease marker

Flow

1. PR Merges → Stone Created

When a PR merges to main, the sis-create-stone.yml workflow runs:

  • Analyzes the PR (commits, affected packages, bump type)
  • Creates a stone in .sisyphus/stones/
  • Commits and pushes the stone

2. Stone Pushed → Release PR Created/Updated

When stones are pushed to main, the sis-release-pr.yml workflow runs:

  • Collects all pending stones
  • Creates/updates a sisyphus/release branch with:
    • Bumped package.json versions
    • Updated changelogs
    • Stones moved from stones/ to released/<timestamp>Z/
    • currentRelease written to config (packages + versions + stone IDs)
  • Creates/updates a PR with the sisyphus-release label

3. Release PR Merges → Publish

When the release PR merges, the sis-release.yml workflow runs:

  • Runs sis roll --publish-only
  • Reads currentRelease from config
  • Publishes packages to npm
  • Creates git tags
  • Creates GitHub release
  • No file changes, no extra commits

Config: currentRelease

{
  "currentRelease": {
    "packages": {
      "@r5n/sisyphus": "1.2.3",
      "@r5n/cli-core": "0.5.0"
    },
    "stoneIds": ["abc123", "def456"]
  }
}

This acts as a marker for what should be published. If publishing fails, sis roll --publish-only can be rerun safely — it will verify if packages are already published before attempting.

Commands

  • sis actions init — Generate workflow files in .github/workflows/
  • sis actions release-pr — Manually create/update release PR
  • sis roll — Full release (bumps + changelog + publish)
  • sis roll --publish-only — Publish from currentRelease (no file changes)

Benefits

  • Single commit — Release PR contains all file changes, no cleanup commits after publish
  • Rerunnable — If publish fails, just rerun the workflow
  • Auditable — Released stones archived in released/ directory
  • Reviewable — Version bumps and changelogs visible in PR diff before merge
  • Regenerable changelogs — If changelog format changes (config or code), changelogs can be regenerated from archived stones

Base automatically changed from r5n-80-pr-command to develop March 12, 2026 06:23
Add `sis actions init` and `sis actions release-pr` commands for
automating releases via GitHub Actions. Includes PR skip configuration
and shared logic refactoring (Stone.mergeAll, Package.applyStone).
createRelease

Introduce provider abstraction layer to support GitHub, GitLab, and
Bitbucket. Currently only GitHub is implemented; GitLab and Bitbucket
are stubbed with "not supported yet" errors.

- Add GitProvider abstract class with PR, label, and release operations
- Add GitHubProvider implementation using gh CLI
- Add factory function to detect provider from git remote
- Rename --github flag to --createRelease for provider-agnostic naming
- Update config, types, and init prompts accordingly
@deralaxo
deralaxo force-pushed the r5n-83-actions-command branch from 285c87a to 55ba5da Compare March 12, 2026 10:57
@deralaxo
deralaxo force-pushed the r5n-83-actions-command branch from 61a5853 to face1fe Compare March 13, 2026 12:13
issues

gh pr create uses GraphQL which fails with GITHUB_TOKEN in Actions.
The REST API works reliably with standard token permissions.
--all selects all workflows, --yes only skips confirmation prompts.
Non-interactive mode now requires explicit workflow selection.
operations

Remove .quiet() from git and gh commands in release-pr and createPr
so errors are visible when operations fail.
Prevents failures when bun.lock or other untracked files exist.
@deralaxo
deralaxo force-pushed the r5n-83-actions-command branch from 86253da to f61cbcf Compare March 13, 2026 14:17
Add git fetch --unshallow for full history, manual trigger support,
and fix skip logic to avoid running unnecessary commands.
When analyzing a merged PR, detect the merge method by checking if the
merge commit has 1 parent (squash) or 2 parents (merge). For squash
merges, create a synthetic commit from the PR title and fetch files
from the API. For merge commits, extract the original commits from
the merge ancestry.
Show each stone as a separate section with heading and description.
Always show Stones section regardless of count.
format

Show only relevant stones in each package's GitHub release notes.
Wrap stones in a collapsible section with nested commits.
Add packageHeader and rootHeader config options for changelog headers.
- packageHeader: "{emoji} {version} ({date})" with {emoji}, {version},
  {date}
- rootHeader: "{date} - {packages}" with {date}, {packages} placeholders
Apply configured author and email to git commits using --author flag.
Add support for filtering commits during changelog analysis based on
author names and message patterns. This prevents automated commits
(bots, release commits) from appearing in changelogs.
The release-pr command now automatically analyzes conventional commits
and generates stones before creating the release PR. Extracted
buildStoneData to CommitAnalyzer as a shared static method.
The PR body now displays individual commits under each stone section
instead of only showing the description.
Prevents duplicate stone generation by tracking the newest processed
commit. Also respects dry-run mode when generating stones.
generated ones

Moves lastStone update to applyReleaseChanges so it considers all
stones being released (both PR-created and commit-generated).
Stones were being generated before checkout, causing them to be lost.
Decompose execute method for readability.
Comment thread packages/sisyphus/src/commands/actions/templates/github/sis-create-stone.yml Outdated
Comment thread packages/sisyphus/src/commands/actions/CiGenerator.ts Outdated

await this.commitAndPushChanges(ctx, stones, packages);
await this.createOrUpdatePr(prTitle, prBody);
await Bun.$`git checkout ${baseBranch}`;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thinking of wrapping all of those git actions into some own module but not sure if that's the time :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Felt like there's no need to do that for the universal ones, but it might me useful later to have the logic in one place. Could do that alongside the plugins/modules support PR

Comment thread packages/sisyphus/src/services/PullRequestAnalyzer.ts Outdated
Comment thread packages/sisyphus/src/services/CommitAnalyzer.ts Outdated
Comment thread packages/sisyphus/src/providers/index.ts Outdated
Comment on lines +39 to +40
case "bitbucket":
return new BitbucketProvider(info);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should always add default and throw/log

Use early continue in loops, computed properties, destructuring spread,
and default cases in switch statements.
- Replace hardcoded values with named constants (UNKNOWN_AUTHOR,
  DEFAULT_VERSION, DEFAULT_NPM_TAG, DEFAULT_BRANCH, etc.)
- Refactor Stone constructor from 6 positional args to options object
- Decompose long methods in release-pr.ts (buildPrBody,
  applyReleaseChanges)
- Add typed API response interfaces for GitHub and GitLab providers
- Remove inline type assertions in favor of proper type definitions
@deralaxo
deralaxo marked this pull request as ready for review March 19, 2026 16:03
@ice-chillios
ice-chillios merged commit 644bde3 into develop Mar 24, 2026
8 of 9 checks passed
@ice-chillios
ice-chillios deleted the r5n-83-actions-command branch March 24, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants