You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Further improve GitHub Actions workflow code style
This makes more stylistic adjustments to YAML workflows files.
(Previous recent adjustments were, for the most part, only those
needed to ensure clarity would be preserved while adding
`permissions:`. This commit does some others that weren't needed
for that.)
The changes made here are:
- Use `actions/checkout@v4`, not `actions/checkout@master`, in the
one place where `@master` was still used for it. This is not
strictly speaking a purely stylistic change, since it is
eventually expected to make a difference, by holding onto major
version 4 until the version is updated (which Depedabot
automates).
- Don't explicitly set the `CI` environment variable in the `test`
job. This variable is guaranteed to be set automatically with the
value of `true` by the GitHub Actions runner. Furthermore, no
environment variables to indicate CI are explicitly set for other
jobs, even though others rely on their presence as well due to
the use of `is_ci` through `gix-testtools`.
- Specify all environment variables' values as strings. Most
values in YAML are strings without explicit quoting. This does
not add quotation marks in those cases. But some values are
parsed as some other type, such as integer, unless quoted. That
makes it less obvious what the value will actually be in the
environment, since it will be implicitly converted to a string,
which does not always consist of the same sequence of characters
as the original expression. This effect is most prominent for
booleans (e.g. unquoted `yes` and `true` in YAML have the same
meaning) but not entirely limited to them. In addition, such
expressions may also lead to confusion if it is misread to mean
that they will retain any kind of type information. So this
quotes such values (except when other changes here remove them).
- Minor quoting style adjustments, for YAML strings are quoted.
Omit quotes when clearly not needed, and use single-quotes by
default when quotes are needed.
- Use 2-space indent inside scripts in script steps for consistency
with other scripts. Most existing multi-line script steps, as
well as all shell scripts, use 2-space indents already.
- Remove `\` in a script step where it was not needed for line
continuation because it followed a `|`.
- In the `wasm` job's script steps, put `name:` and, when present,
`if:`, ahead of `run:`, so it's clear what each step is for.
(This was already done where applicable in other jobs.)
- In the `wasm` job's script steps, split single-line `run:` values
with `&&` into separate commands, one per line, where doing so
has the same effect due to the `-e` option the CI runner
automatically passes to `bash` shells unless `shell:` is
overridden with a value that contains `{0}`.
- In the `wasm` job's script steps, split single-line `run:`
values with `;` into separate lines, including running loops over
multiple lines, for readability.
- In the `wasm` job, extract `${{ matrix.target }}` to an
environment variable. This seems to make the steps slightly more
readable, since `wasm` steps make heavy use of it.
- Extremely minor adjustment to array style, for consistency.
- In commands, use `--` where guaranteed to be supported if any
non-option argument begins with parameter expansion or a glob.
This was already almost, but not quite, already done. Since the
possible values can be inferred from nearby code and do not
begin with `-`, the reason is to clearly communicate that they
are non-option arguments, rather than to fix any actual bug.
(This continues to be avoided where is not guaranteed correct.)
- Use the `-e` option before a pattern argument to `grep` formed
through parameter expansion (same rationale as `--` above).
- Use `-E` rather than `-r` with `sed`, since `-E` is standardized.
0 commit comments