-
Notifications
You must be signed in to change notification settings - Fork 64.3k
Correct template-specific workflow syntax #5104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Drafting my PR template. ### Why: **Closes github#5103 ### What's being changed: [The syntax `$default-branch` is specific to workflow templates only and cannot be used in standard workflows.](https://github.com/github/docs/discussions/5071) As a result, a copy-paste of the existing yaml workflow for "Starting with the Node.js workflow template" will fail. See steven-wolfman/test-workflow-template-syntax@0d006c5#diff-fbdccf80e37a6640cb78bdcf9d90597cb91421747fd5c2365d878287e744ff99 for an example commit that triggers a workflow using the `main` syntax but fails to trigger workflows using the `$default-branch` syntax. ### Check off the following: - [ ] I have reviewed my changes in staging. (look for the **deploy-to-heroku** link in your pull request, then click **View deployment**) - [x] For content changes, I have reviewed the [localization checklist](https://github.com/github/docs/blob/main/contributing/localization-checklist.md) - [x] For content changes, I have reviewed the [Content style guide for GitHub Docs](https://github.com/github/docs/blob/main/contributing/content-style-guide.md).
|
Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines. |
| {% data variables.product.prodname_dotcom %} provides a Node.js workflow template that will work for most Node.js projects. This guide includes npm and Yarn examples that you can use to customize the template. For more information, see the [Node.js workflow template](https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml). | ||
|
|
||
| To get started quickly, add the template to the `.github/workflows` directory of your repository. | ||
| To get started quickly, add the template to the `.github/workflows` directory of your repository. (If your default branch is not named `main`, change `main` to your default branch's name.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love feedback from a writer on how and whether to comment on what to do for people whose default branch is not named main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever text ends up being used, the same text should appear in the Ruby version also changed in this commit.
Exactly parallel changes. Should be kept in sync with the Node.js changes.
Nirzak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not compulsory to rename your default branch main. I have set "source' as my default branch and I have written the workflow as on: push: branches: [source] and the code just works fine for me. So, default-branch option is the correct one. It shouldn't be stated as 'main' as people can rename their default branch to any name.
I agree that it is not compulsory to name the default branch main. The trouble is that the existing code shows I'm unsure whether putting Does that make sense? |
Yeah I agree but for that an elaborated documentation is needed. If we just put main in the raw code then many one will think they have to set main in their workflow. So the people who have default-branch named as "master" will face error. |
Just to make this more concrete, please do open steven-wolfman/test-workflow-template-syntax@0d006c5 There, you can see that a workflow that directly copies-and-pastes the |
Totally, but isn't that better than the current case where everyone will have an error? And.. is the correct fix for the more elaborate documentation to clarify the need for rename just before the code block (which is what I tried)? Thanks! |
Yeah default-branch must have to be rename as the branch name that you've set as your default-branch. Set it as main in the raw code will help many ones because we know a huge number of github users are using main as their default-branch. But it still there should be extra documentation for those who have custom default-branch. |
|
Thanks so much for opening an issue and a PR @steven-wolfman! You don't need to worry about any of the translations, updated content in English is automatically sent to our translators once it's merged. I'll get this triaged for review ⚡ |
|
Thanks!
…---------------------------------
Steven A. Wolfman Ph.D. (he/him)
Professor of Teaching
Department of Computer Science
The University of British Columbia | Vancouver Campus | Musqueam Traditional Territory
201-2366 Main Mall | Vancouver BC | V6T 1Z4 Canada
***@***.***
On Thu, 8 Apr 2021, Janice wrote:
Date: Thu, 8 Apr 2021 15:07:00
From: Janice ***@***.***>
Reply-To: github/docs
***@***.***>
To: github/docs ***@***.***>
Cc: Steve Wolfman ***@***.***>, Mention ***@***.***>
Subject: Re: [github/docs] Correct template-specific workflow syntax (#5104)
[CAUTION: Non-UBC Email]
Thanks so much for opening an issue and a PR @steven-wolfman! You don't need to worry about any of the translations, updated content in English is automatically sent to our translators
once it's merged. I'll get this triaged for review ⚡
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.[AAHPZBPO67PR7PKS4RTSTUTTHYSIJA5CNFSM42PKHEV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGCTSSMA.gif]
|
lucascosti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, @steven-wolfman! I slightly reworded the mentioning of main before the workflow, and replaced a few other instances of $default-branch in the ruby article.
I'll get this merged in! 🎉
|
Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues ⚡ |
Why:
Closes #5103
What's being changed:
The syntax
$default-branchis specific to workflow templates only and cannot be used in standard workflows. As a result, a copy-paste of the existing yaml workflow for "Starting with the Node.js workflow template" will fail. See steven-wolfman/test-workflow-template-syntax@0d006c5#diff-fbdccf80e37a6640cb78bdcf9d90597cb91421747fd5c2365d878287e744ff99 for an example commit that triggers a workflow using themainsyntax but fails to trigger workflows using the$default-branchsyntax.Check off the following: