Skip to content

Docs: --commit-id publishes the changes in that commit, not since it (publish.md example uses github.event.before) #333

Open

Description

@MO2k4

docs/commands/publish.md describes --commit-id differently from what the code and the generated pipelines do.

Docs (Incremental publish):

When --commit-id is provided, apiops publish uses git diff to identify which artifact files changed since that commit.

and the GitHub Actions example passes the commit before the push:

- run: npx apiops publish --commit-id ${{ github.event.before }}

Code (src/services/git-diff-service.ts) diffs commitId~1 against commitId, so it publishes the changes made by that commit, not the changes since it.

The generated pipelines agree with the code: the GitHub Actions template passes GITHUB_SHA (publish-workflow.ts) and the Azure DevOps template passes $(Build.SourceVersion).

Effect of following the docs example: with github.event.before, publish diffs the previous push's last commit against its parent. It republishes the previous push's last commit and skips the commit that just landed. The run succeeds, so nothing flags it.

Suggested fix: change the sentence to "identify which artifact files changed in that commit (compared with its parent)" and the example to --commit-id ${{ github.sha }}. If a push contains several commits, it may also be worth saying that only the last one is published, or supporting a range.

Seen on 1.0.5 (npm) and on main at 129fb32.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions