Skip to content

Run CI publish step on latest branch only #13

@MichaelCurrin

Description

@MichaelCurrin

I have PRs which are failing on this GH Actions publish step:

https://github.com/getmeli/meli-docs/blob/latest/.github/workflows/main.yml#L25

This is expected, as my fork does have secrets setup to publish to someone else's NPM or GH account.

Another problem is that even if the maintainer of the repo (who does have access) makes a PR from a branch to latest, the publish step will run on the branch (which may not be production ready). It would be safer to make the publish step on run when code is on latest branch (or if you were more conservative, only run when a tag is created).

Therefore can I suggest that an if conditional which makes the publish step only run when the branch is latest? I've used this in my Vue project to skip publishing when the event type is pull_request (which avoids hardcoding latest or master).

https://github.com/MichaelCurrin/badge-generator/blob/master/.github/workflows/main.yml#L51-L52

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions