From 86edc04b2471424ede11d16d8bab0f396acb3a5a Mon Sep 17 00:00:00 2001 From: Steve Wolfman Date: Tue, 6 Apr 2021 11:55:32 -0700 Subject: [PATCH 1/4] Correct template-specific workflow syntax Drafting my PR template. ### Why: **Closes https://github.com/github/docs/issues/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 https://github.com/steven-wolfman/test-workflow-template-syntax/commit/0d006c52a904911ddb71a13994a4864d7d022e1c#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). --- content/actions/guides/building-and-testing-nodejs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index 9d3788267663..196347c235c8 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -37,7 +37,7 @@ We recommend that you have a basic understanding of Node.js, YAML, workflow conf {% 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.) {% raw %} ```yaml{:copy} @@ -45,9 +45,9 @@ name: Node.js CI on: push: - branches: [ $default-branch ] + branches: [ main ] pull_request: - branches: [ $default-branch ] + branches: [ main ] jobs: build: From e8c6cdaf7356db6ae7dc0e4ca1c402d63b1e86b5 Mon Sep 17 00:00:00 2001 From: Steve Wolfman Date: Tue, 6 Apr 2021 12:33:50 -0700 Subject: [PATCH 2/4] Patch the same $default-branch issue for Ruby Exactly parallel changes. Should be kept in sync with the Node.js changes. --- content/actions/guides/building-and-testing-ruby.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/actions/guides/building-and-testing-ruby.md b/content/actions/guides/building-and-testing-ruby.md index c2dde2eef5c9..77906c40242a 100644 --- a/content/actions/guides/building-and-testing-ruby.md +++ b/content/actions/guides/building-and-testing-ruby.md @@ -31,7 +31,7 @@ We recommend that you have a basic understanding of Ruby, YAML, workflow configu {% data variables.product.prodname_dotcom %} provides a Ruby workflow template that will work for most Ruby projects. For more information, see the [Ruby workflow template](https://github.com/actions/starter-workflows/blob/master/ci/ruby.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.) {% raw %} ```yaml @@ -39,9 +39,9 @@ name: Ruby on: push: - branches: [ $default-branch ] + branches: [ main ] pull_request: - branches: [ $default-branch ] + branches: [ main ] jobs: test: From 401cc6cc5eed5cb74a316b575939708049dd18fd Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Tue, 13 Apr 2021 14:36:36 +1000 Subject: [PATCH 3/4] Change message for mentioning `main` --- content/actions/guides/building-and-testing-nodejs.md | 2 +- content/actions/guides/building-and-testing-ruby.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index 196347c235c8..ed249dc7fead 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -37,7 +37,7 @@ We recommend that you have a basic understanding of Node.js, YAML, workflow conf {% 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. (If your default branch is not named `main`, change `main` to your default branch's name.) +To get started quickly, add the template to the `.github/workflows` directory of your repository. The workflow shown below assumes that the default branch for your repository is `main`. {% raw %} ```yaml{:copy} diff --git a/content/actions/guides/building-and-testing-ruby.md b/content/actions/guides/building-and-testing-ruby.md index 77906c40242a..85e45bcae2d8 100644 --- a/content/actions/guides/building-and-testing-ruby.md +++ b/content/actions/guides/building-and-testing-ruby.md @@ -31,7 +31,7 @@ We recommend that you have a basic understanding of Ruby, YAML, workflow configu {% data variables.product.prodname_dotcom %} provides a Ruby workflow template that will work for most Ruby projects. For more information, see the [Ruby workflow template](https://github.com/actions/starter-workflows/blob/master/ci/ruby.yml). -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.) +To get started quickly, add the template to the `.github/workflows` directory of your repository. The workflow shown below assumes that the default branch for your repository is `main`. {% raw %} ```yaml From 039c7044770db8adbe029d60fe3702c55ad63eb0 Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Tue, 13 Apr 2021 14:36:59 +1000 Subject: [PATCH 4/4] Replace a few more instances of $default-branch --- .../actions/guides/building-and-testing-ruby.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/actions/guides/building-and-testing-ruby.md b/content/actions/guides/building-and-testing-ruby.md index 85e45bcae2d8..79faf88e3967 100644 --- a/content/actions/guides/building-and-testing-ruby.md +++ b/content/actions/guides/building-and-testing-ruby.md @@ -105,9 +105,9 @@ name: Ruby CI on: push: - branches: [ $default-branch ] + branches: [ main ] pull_request: - branches: [ $default-branch ] + branches: [ main ] jobs: test: @@ -211,9 +211,9 @@ name: Matrix Testing on: push: - branches: [ $default-branch ] + branches: [ main ] pull_request: - branches: [ $default-branch ] + branches: [ main ] jobs: test: @@ -272,11 +272,11 @@ name: Ruby Gem on: # Manually publish workflow_dispatch: - # Alternatively, publish whenever changes are merged to the default branch. + # Alternatively, publish whenever changes are merged to the `main` branch. push: - branches: [ $default-branch ] + branches: [ main ] pull_request: - branches: [ $default-branch ] + branches: [ main ] jobs: build: