Skip to content
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

Update building-and-testing-net.md #32613

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.actions.new-starter-workflow %}
1. The "{% ifversion actions-starter-template-ui %}Choose a workflow{% else %}Choose a workflow template{% endif %}" page shows a selection of recommended starter workflows. Search for "dotnet".

Check warning on line 36 in content/actions/automating-builds-and-tests/building-and-testing-net.md

View workflow job for this annotation

GitHub Actions / lint-content

Liquid `ifversion` (and `elsif`) should not always be true

The Liquid ifversion condition 'actions-starter-template-ui' includes all possible versions and will always be true
1. On the ".NET" workflow, click {% ifversion actions-starter-template-ui %}**Configure**{% else %}**Set up this workflow**{% endif %}.

Check warning on line 37 in content/actions/automating-builds-and-tests/building-and-testing-net.md

View workflow job for this annotation

GitHub Actions / lint-content

Liquid `ifversion` (and `elsif`) should not always be true

The Liquid ifversion condition 'actions-starter-template-ui' includes all possible versions and will always be true

{%- ifversion ghes %}

Expand Down Expand Up @@ -135,11 +135,11 @@
run: dotnet add package Newtonsoft.Json --version 12.0.1
```

{% ifversion actions-caching %}

Check warning on line 138 in content/actions/automating-builds-and-tests/building-and-testing-net.md

View workflow job for this annotation

GitHub Actions / lint-content

Liquid `ifversion` (and `elsif`) should not always be true

The Liquid ifversion condition 'actions-caching' includes all possible versions and will always be true

### Caching dependencies

You can cache NuGet dependencies using a unique key, which allows you to restore the dependencies for future workflows with the [`cache`](https://github.com/marketplace/actions/cache) action. For example, the YAML below installs the `Newtonsoft` package.
You can cache NuGet dependencies for future workflows using the optional `cache` input. For example, the YAML below caches the NuGet `global-packages` folder, and then installs the `Newtonsoft` package. A second optional input, `cache-dependency-path`, can be used to specify the path to a dependency file: `packages.lock.json`.

For more information, see "[AUTOTITLE](/actions/using-workflows/caching-dependencies-to-speed-up-workflows)."

Expand All @@ -149,14 +149,8 @@
- name: Setup dotnet
uses: {% data reusables.actions.action-setup-dotnet %}
with:
dotnet-version: '6.0.x'
- uses: {% data reusables.actions.action-cache %}
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: {% raw %}${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget{% endraw %}
dotnet-version: '6.x'
cache: true
- name: Install dependencies
run: dotnet add package Newtonsoft.Json --version 12.0.1
```
Expand Down