github-actions-style
/github-actions-style
GitHub Actions workflow and composite action conventions for MLflow. Use when writing, modifying, or reviewing workflows in .github/workflows/ or actions in .github/actions/ in this repository.
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
What it does and when to use it
GitHub Actions workflow and composite action conventions for MLflow. Use when writing, modifying, or reviewing workflows in .github/workflows/ or actions in .github/actions/ in this repository.
Original author description
GitHub Actions workflow and composite action conventions for MLflow. Use when writing, modifying, or reviewing workflows in .github/workflows/ or actions in .github/actions/ in this repository.
How it works
- Name Steps When the Name Adds Information
- Reinvent the Wheel When It's Cheap
- Use ubuntu-slim for Lightweight Tasks
- Use Workflow Context Instead of Fetching
- Prefer Job Conditions Over Shell Guards
- Prefer gh CLI over actions/github-script
- Prefer GITHUBTOKEN When Its Scope and Trigger Behavior Are Sufficient
- Prefer the Shared Setup Actions
- Use sparse-checkout When Only a Subset of Files Is Needed
- pipefail Is Already On
SKILL.md preview
---
name: github-actions-style
description: GitHub Actions workflow and composite action conventions for MLflow. Use when writing, modifying, or reviewing workflows in .github/workflows/ or actions in .github/actions/ in this repository.
---
# GitHub Actions Workflow Guidelines
## Name Steps When the Name Adds Information
GitHub Actions UI shows only the first line of an unnamed `run:` step. Add a short,
action-oriented `name:` when it explains the whole step better than that line,
even if the first command is clear:
```yaml
# Bad: the GitHub Actions UI shows only the condition.
- run: |
if [ "$RUN_TESTS" = true ]; then
npm test
fi
# Good: the name explains the step.
- name: Run tests
run: |
if [ "$RUN_TESTS" = true ]; then
npm test
fi
```
Omit a name that merely restates a self-explanatory command, such as
`Install dependencies` for `npm ci`. An action path like
`./.github/actions/setup-python` can also speak for itself. Keep names concise;
the job name often supplies enough context.
## Reinvent the Wheel When It's Cheap
Prefer a small `run:` step or repository script over a third-party action when
the behavior is straightforward and cheap to implement and maintain. Use tools
already available in the job, such as `gh`, `curl`, or Python. A few lines of
code can avoid another dependency to audit, pin, and update, reduce exposure to
supply chain attacks, and skip the action's download overhead.
```yaml
# Bad: adds a dependency just to label a PR
- uses: example/label-pr@...
with:
label: needs-review
# Good
- env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: gh pr edit "$PR_NUMBER" --repo "$REPO" --add-label needs-review
```
Use a third-party action when it provides substantial functionality that would
be costly or error-prone to reproduce.
## Use `ubuntu-slim` for Lightweight Tasks
Prefer `ubuntu-slim` over `ubuntu-24.04` for simple jobs (e.g., labeling, commenting, notifications).
Note: `ubuntu-slim` has a 15-minute timeout limit. Use `ubuntu-24.04` for long-running jobs (e.g., polling).
```yaml
# Bad
runs-on: ubuntu-24.04
# Good
runs-on: ubuntu-slim
```
## Use Workflow Context Instead of Fetching
If the trigger event already carries the data, read it from the `github` context instead of calling `gh` or `actions/github-script`. Extra API calls burn rate-limit budget and add a flaky network hop for nothing.
```yaml
# Bad
- env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
HEAD_SHA=$(gh pr view "$PR_NUMBER" --json headRefOid -q .headRefOid)
# Good
- env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: echo "$HEAD_SHA"
```
Only fetch when the data isn't in the payload (e.g., check runs, review threads, changed files on `issue_comment`).
## Prefer Job Conditions Over Shell Guards
When a condition determines whether a job has any work and can be evaluated
from workflow contexts, use a job-level `if` instead of starting a `run` script
and checking the condition in the shell. GitHub can then skip the job without
provisioning a runner.
```yaml
# Bad: every opened issue provisions a runner before checking its title
jobs:
label:
runs-on: ubuntu-slim
steps:
- env:
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
if echo "$ISSUE_TITLE" | grep -qi "bug report"; then
gh issue edit ... --add-label bug
fi
# Good: unrelated issues skip the job before a runner is provisioned
jobs:
label:
if: contains(github.event.issue.title, 'bug report')
runs-on: ubuntu-slim
steps:
- run: gh issue edit ... --add-label bug
```
Keep the condition inside `run` when it depends on information produced on the
runner or a command's result and cannot be evaluated as a workflow expression.
## Prefer `gh` CLI over `actions/github-script`
For simple GitHub API operations (commenting, labeling, cancelling runs, etc.),
use `gh` CLI instead of `actions/github-script`. It avoids the need for
`actions/checkout` and JavaScript boilerplate.
```yaml
# Bad
- uses: actions/checkout@...
- uses: actions/github-script@...
with:
script: |
const script = require(".github/workflows/my-script.js");
await script({ context, github });
# Good
- env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ...
```
## Prefer `GITHUB_TOKEN` When Its Scope and Trigger Behavior Are Sufficient
Use `${{ secrets.GITHUB_TOKEN }}` by default for operations in the current repository when its job-level permissions are sufficient. Use `actions/create-github-app-token` when access to other repositories or separately scoped credentials is required, or when the resulting GitHub event must trigger another workflow. Events created with `GITHUB_TOKEN` [generally do not trigger workflow runs](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow).
```yaml
# Bad: this comment does not need to trigger another workflow
- uses: actions/create-github-app-token@...
id: app-token
with:
# ...
- env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: gh issue comment ...
# Good
- env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh issue comment ...
```
## Prefer the Shared Setup Actions
Set up toolchains through the composite actions in `.github/actions/` rather than
calling the upstream actions directly. Each one centralizes the pinned version and
the env defaults every job expects, so an upstream bump stays a one-line change
instead of a repo-wide sweep.
| Toolchain | Action |
| --------------- | -------------------------------- |
| Python and `uv` | `./.github/actions/setup-python` |
| Node | `./.github/actions/setup-node` |
| Java | `./.github/actions/setup-java` |
```yaml
# Bad: a second copy of the pin to keep in sync, and no uv or env defaults
- uses: actions/setup-python@...
# Good
- uses: ./.github/actions/setup-python
```
Local action paths resolve relative to `$GITHUB_WORKSPACE`, so a workflow that
checks the repo out into a subdirectory needs that prefix
(`./mlflow/.github/actions/setup-python`). Never point it at a PR head checkout:
that runs author-controlled code with whatever secrets the workflow holds.
## Use `sparse-checkout` When Only a Subset of Files Is Needed
When a workflow only needs a small subset of the repo (e.g., a single script under `.github/`), pass `sparse-checkout` to `actions/checkout` instead of cloning the whole tree. A full checkout of this repo takes around 10 seconds on average; a sparse checkout finishes in a fraction of that.
```yaml
# Bad: clones the entire repo just to run one script
- uses: actions/checkout@...
- run: bash .github/scripts/my-script.sh
# Good: only fetches what the job actually reads
- uses: actions/checkout@...
with:
sparse-checkout: |
.github/scripts/my-script.sh
sparse-checkout-cone-mode: false
- run: bash .github/scripts/my-script.sh
```
When listing directories, leave cone mode on (the default):
```yaml
- uses: actions/checkout@...
with:
sparse-checkout: |
.github/scripts
dev
```
Set `sparse-checkout-cone-mode: false` only when you need to target individual files or non-prefix glob patterns.
## `pipefail` Is Already On
Every workflow in this repo sets top-level `defaults.run.shell: bash` (enforced by [`.github/policy.rego`](../../../.github/policy.rego)). GitHub Actions runs `shell: bash` as `bash --noprofile --norc -eo pipefail {0}`, so `pipefail` is already enabled. Don't ask for `set -o pipefail` in workflow `run:` steps. ([docs](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#defaultsrunshell))
## Mask Secrets Generated Mid-Job
Values that come from `secrets.*` are masked automatically. Anything a step
mints at runtime (an OAuth token exchanged over `curl`, a random passphrase, a
value decoded out of another secret) is not, so the first command that echoes it
prints it in clear text. Emit
[`::add-mask::`](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#masking-a-value-in-a-log)
the moment the value exists, before it reaches `$GITHUB_OUTPUT` or any other
command.
```yaml
# Bad: nothing stops a later command from printing the token
- run: |
TOKEN=$(curl -sS ... | jq -r .access_token)
echo "token=$TOKEN" >> "$GITHUB_OUTPUT"
# Good
- run: |
TOKEN=$(curl -sS ... | jq -r .access_token)
echo "::add-mask::$TOKEN"
echo "token=$TOKEN" >> "$GITHUB_OUTPUT"
```
`set -x` needs separate care: xtrace prints the assignment itself, so the value
is in the log before the mask can register. Don't enable it in a step that mints
a secret.
The mask covers only the job that registered it, and a masked value cannot be
handed to another job through job-level `outputs`: GitHub redacts it on the
runner. Mint and mask it again in the job that needs it.
## Never Write Secrets to `$GITHUB_ENV`
`$GITHUB_ENV` promotes a value into the environment of every later step in the
job, and of every process those steps spawn (third-party actions, `npm install`
lifecycle scripts, the test suite). Hand it to the consuming step through
`$GITHUB_OUTPUT` and a step-level `env:` block instead, so a step that has no
use for the secret never holds it.
```yaml
# Bad: the test step inherits a token it never asked for
- id: auth
run: |
TOKEN=$(curl -sS ... | jq -r .access_token)
echo "::add-mask::$TOKEN"
echo "TOKEN=$TOKEN" >> "$GITHUB_ENV"
- run: uv run dev/deploy.py # needs $TOKEN
- run: uv run pytest tests/ # doesn't, but gets it anyway
# Good: the token reaches only the step that consumes it
- id: auth
run: |
TOKEN=$(curl -sS ... | jq -r .access_token)
echo "::add-mask::$TOKEN"
echo "token=$TOKEN" >> "$GITHUB_OUTPUT"
- env:
TOKEN: ${{ steps.auth.outputs.token }}
run: uv run dev/deploy.py
- run: uv run pytest tests/ # no $TOKEN in its environment
```
The same holds for a secret that comes straight from `secrets.*`: put it in the
consuming step's `env:` block rather than exporting it job-wide.
Versions
The database has no other skills named github-actions-style.
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version acd36a9b5425 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90github-actions
Apply when writing or editing any workflow, composite action, job, or step — and read the owner pointers before adding a rule. Esposter's GitHub Actions authoring for `.github/workflows` and `.github/actions`: how a step is written. - 95python-style
Python coding and testing conventions for MLflow. Use when writing, modifying, or reviewing Python source files and tests in this repository. - 100github-actions-single-repo-workflows
Authors and troubleshoots GitHub Actions workflow YAML that lives in and serves a single repository — triggers, jobs/steps, matrix builds, caching with actions/cache, and composite actions defined within the same repo under .github/actions/. Use when the user asks to "write a… - 100github-workflows
Work with GitHub Actions CI/CD workflows - read live syntax, monitor runs, and debug failures. Use when writing, running, or debugging GitHub Actions workflows. - 100github-workflows
Work with GitHub Actions CI/CD workflows - read live syntax, monitor runs, and debug failures. Use when writing, running, or debugging GitHub Actions workflows. - 100github-actions
GitHub Actions workflow generator — CI/CD pipelines, releases, Docker builds, reusable workflows, composite actions, dependabot. Use for .github/workflows/ generation, debugging, and security hardening.