- 'dotnetBuild' builds Stirling Labs C# repos that are prepared appropriately:
- Include Version.Net (see page for details)
- Uses GitHubActionsTestLogger (
dotnet add package GitHubActionsTestLogger
)
dotnetRelease
linter
lints code, including this repo.- 'metadata' tries to get information about the project.
name
tries to get the project name (used by metadata).Threshold
reduces pointless runs if nothing has changed since the last run (use[forceci]
in commit message to force run).version
tries to ascertain the version of the project (used by metadata).
- See GitHub documentation on [Reusable Workflows]](https://github.blog/2022-02-10-using-reusable-workflows-github-actions/) for details.
- Break up steps as much as you can, practically. This makes it easier for users to see what has happened.
echo
enough to make sure a user can see what has gone wrong. Be a bit more verbose than you might assume, because users won't have as much context as you do when writing it.- Use bash as your shell unless forced not to by some important external requirement.
default: ... shell: bash
is generally available and should be used whenever possible- job-level
env
is useful for turning off dotnet tracking & logo:env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true
- Within steps:
env
comes beforerun
- Use bash functions to organise code
- At least
main() {}
- At least
- End bash scripts with at least
exit
but ideallymain "$@" ; exit
. This makes it easy to see the end of the script within the Action (amoung other benefits).
- lowerCamelCase variables in bash but lower_snake_case in
$GITHUB_OUTPUT
. - Try not to use "true" & "false" as string values (it is confusing when compared to input booleans) rather use more meaningful variables and values. E.g.
- ❌
continue=true
- ✅
result=success
- ❌