Skip to content

Correct use of $default-branch syntax for an example of a standard (non-template) workflow #5103

@steven-wolfman

Description

@steven-wolfman

What article on docs.github.com is affected?

https://docs.github.com/en/actions/guides/building-and-testing-nodejs#starting-with-the-nodejs-workflow-template

What part(s) of the article would you like to see updated?

The yaml example given for copy-paste in the Starting with the Node.js workflow template section uses $default-branch as the branch filter within both the push and pull-request events.

The $default-branch syntax is correct for a starter template like the Node.js starter and is automatically changed to the repository's default branch on instantiating the template.

However, copy-pasting this syntax as suggested in this section creates an incorrect workflow.

In place of $default-branch, the code for copy-paste should use main (the current default for the default branch) and perhaps indicate that users need to edit this if they have a different default branch name.

Additional information

Here is a commit showing that main syntax works but $default-branch syntax does not: steven-wolfman/test-workflow-template-syntax@0d006c5#diff-fbdccf80e37a6640cb78bdcf9d90597cb91421747fd5c2365d878287e744ff99. (Click the check-mark to see that only the workflow using standard syntax runs while, e.g., the workflow copy-pasted from the docs does not run.

You can read a discussion thread indicating that $default-branch is template-specific syntax.

Aside: If that raw YAML is somehow automatically-generated from the Node.js starter, which seems like a great idea, then this will require more care.

P.S. I'm putting this issue in as I prep a PR to correct this, but the contributing guidelines suggested starting with an issue. 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentThis issue or pull request belongs to the Docs Content teamtriageDo not begin working on this issue until triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions