MSBA-308 · Lesson 5 of 12 · 21 min
Domain review: building actions
▶ Video coming soon A video version of this lesson is on the way.
Lena had built Tidewater's markdown-guard composite action herself, watched Dmitri bundle trail-units as a JavaScript action and helped Priya debug the Docker-based pdf-proof action. The third domain, Author and maintain actions, carries 15 to 20 of the exam weight, and on the Tuesday of the second week she expected it to be easy. Priya started with a question that slowed her down: "Why is pdf-proof a Docker action and not a JavaScript one?" Lena knew the answer from the project, the licensed fonts baked into the image, but not the general rule the exam would want. The domain has three subgroups: creating and troubleshooting custom actions, defining their structure and metadata, and distributing and maintaining them. Building Custom Actions taught all of it.
Choosing an action type
Every action is defined by a metadata file, action.yml or action.yaml, at the root of the action's repository or folder. Its runs section decides the type. The exam's type questions are about choosing the right one for a described need.
| JavaScript | Docker container | Composite | |
|---|---|---|---|
| runs.using | node24 (Node 20 was removed from runners in 2026) | docker | composite |
| Runs on | Linux, Windows and macOS runners | Linux runners only | Any runner the steps support |
| Start-up | Fast; runs directly on the runner | Slower; builds or pulls an image | Fast; just steps |
| Best for | Cross-platform logic, API calls with the toolkit | A fixed environment or tools that must be identical | Bundling existing steps and actions |
| Dependencies | Bundled into the repository, often with a build tool | Inside the image | Whatever the steps use |
| Entry points | main, with optional pre and post | image, with entrypoint, args, pre-entrypoint and post-entrypoint | steps; each run step needs a shell |
Docker actions run only on Linux runners. That is the most tested limitation in this domain: a question describing a team that needs an action on Windows and macOS runners rules Docker out. JavaScript actions must not depend on packages being installed on the runner; their dependencies are committed, usually compiled into a single file with a bundler, as Dmitri did with Rollup. Composite actions require an explicit shell on every run step, because they cannot assume the caller's default.
The runtime detail moved during 2026. Node 24 became the default for JavaScript actions in June 2026, and Node 20 was removed from GitHub-hosted runners in September 2026, so a current action declares using: node24. An exam question might show an older action still using node20 and ask why it fails or warns on current runners. The outline does not test dates; it tests knowing that the runtime is declared in metadata and must be one the runner supports.
Metadata and structure
The second subgroup asks you to specify required files, directory structure and metadata, and implement workflow commands within actions. A minimal metadata file has a name, a description and a runs section. Inputs and outputs are declared so callers and the editor know what to pass. Branding sets the Marketplace icon and color.
name: 'Markdown Guard'
description: 'Checks Tidewater guide chapters for style and broken links'
inputs:
path:
description: 'Folder of Markdown files'
required: true
fail-on-warning:
description: 'Treat warnings as failures'
default: 'false'
outputs:
problems:
description: 'Number of problems found'
value: ${{ steps.check.outputs.problems }}
runs:
using: 'composite'
steps:
- id: check
shell: bash
run: ./check.sh "${{ inputs.path }}"
env:
FAIL_ON_WARNING: ${{ inputs.fail-on-warning }}
branding:
icon: 'check-square'
color: 'green'A few metadata rules show up repeatedly in questions. Input values always arrive as strings. In a composite action, an output needs a value that points at a step output, as above; in a JavaScript action, the code sets the output with the toolkit and the metadata only declares it. In a JavaScript or Docker action, inputs also appear as environment variables named INPUT_ followed by the input name in capitals. Inputs passed to run commands should go through env rather than being pasted directly into the script, for the script injection reasons covered in lesson 7.
Workflow commands work inside actions exactly as they do in workflows. A JavaScript action uses the toolkit functions, such as core.setOutput, core.setFailed, core.addPath and core.summary, which write to the same environment files. A composite or Docker action writes to GITHUB_OUTPUT, GITHUB_ENV and GITHUB_STEP_SUMMARY directly, and prints ::error::, ::warning:: and ::add-mask:: lines for annotations and masking. Setting a failed exit code is how any action marks its step as failed.
Troubleshooting actions
The outline pairs creating actions with troubleshooting them. Most action problems fall into a few patterns.
| Symptom | Likely cause | Fix |
|---|---|---|
| Cannot find module when the action starts | node_modules not committed and code not bundled | Bundle the code into dist and commit it |
| Docker action fails on a Windows runner | Docker actions run only on Linux | Use a JavaScript or composite action, or a Linux runner |
| Composite step error: shell required | A run step in a composite action has no shell | Add shell to every run step |
| Output is always empty | Composite output has no value mapping, or the step id is wrong | Map value to the step output with the right id |
| Action version suddenly behaves differently | Caller used a moving tag that was updated | Pin to a full commit SHA, or check the release notes |
| A private action is not found from another repository | Access not granted in the action repository's settings | Allow access from repositories in the organization |
Worked problem
Choosing a type from a scenario
A team needs an action that calls an internal API, formats the response and posts a job summary. It must run on Ubuntu, Windows and macOS runners, and start quickly. Which type fits?
Show solution
- Three operating systems rule out a Docker action.
- The logic is more than a sequence of existing commands: it calls an API and formats data.
- A JavaScript action runs on all three, starts fast and can use the toolkit for the summary.
Answer: A JavaScript action using node24, with its code bundled.
Distribution and maintenance
The last subgroup asks you to choose distribution models, publish to the Marketplace, and apply versioning and release strategies.
| Model | Who can use it | How |
|---|---|---|
| Same repository | Workflows in that repository | uses: ./path/to/action |
| Private repository shared in the organization | Repositories the owner allows | Access setting in the action repository's Actions settings |
| Internal repository (enterprise) | Repositories in the enterprise's organizations | Access setting as above |
| Public repository | Anyone, subject to their allowed-actions policy | uses: owner/repo@ref |
| GitHub Marketplace | Anyone, and discoverable | Publish a release from a public repository with a single action.yml at the root |
Publishing to the Marketplace has requirements the exam likes. The action must be in a public repository, with a single metadata file at the root, and the repository should contain only the action. Its name must be unique and must not match a GitHub user, organization or existing category. Publishing is done from the release page, after accepting the Marketplace Developer Agreement, and the account must have two-factor authentication. Malik published his trail-report action this way in October 2026, listed under two categories.
Versioning follows a well-known pattern. Each release gets a full semantic version tag, such as v1.2.0. A major version tag, such as v1, is moved to the newest compatible release so that callers who use @v1 receive fixes. Since October 2025 publishers can make releases immutable, so a published release's tag and assets cannot be changed. GitHub's guidance is to keep the moving major tag as an ordinary tag, since an immutable tag cannot move. Breaking changes go in a new major version, announced in release notes, with the old major still working for a while.
From the consumer's point of view, which the security domain covers, the safest reference is a full commit SHA with the version in a comment. From the publisher's point of view, the job is to make that safe reference easy: clear releases, immutable tags and a moving major tag for those who choose convenience.
Worked problem
Planning a breaking change
markdown-guard v1 accepts a link-check input that Lena wants to remove. Several repositories use @v1. How should she release the change?
Show solution
- Removing an input is a breaking change, so it belongs in a new major version.
- Release v2.0.0 without the input, with notes explaining the change and how to migrate.
- Create a v2 tag pointing at v2.0.0; leave v1 pointing at the last v1 release.
- Optionally have v1 print a deprecation warning, then retire it after callers move.
Answer: Release v2.0.0 and a new v2 tag, keep v1 unchanged, document the migration and deprecate v1 later.
Workflow commands in actions
Actions talk to the runner through workflow commands and environment files. Commands written to standard output with a double colon prefix create annotations (error, warning and notice, optionally with a file and line), group log lines into collapsible sections, and mask values. Environment files replace older commands: an action writes outputs to GITHUB_OUTPUT, environment variables for later steps to GITHUB_ENV, extra folders for the path to GITHUB_PATH and Markdown to GITHUB_STEP_SUMMARY. The set-output and save-state commands that older material shows were deprecated in favor of these files, so an option that uses set-output is likely a distractor.
- name: Report coverage
shell: bash
run: |
echo "::group::Coverage details"
cat coverage.txt
echo "::endgroup::"
echo "::warning file=src/map.js,line=42::Branch not covered"
echo "percent=81" >> "$GITHUB_OUTPUT"Inside each action type
Each type has a few details the exam likes. A JavaScript action names its runtime with using: node24 and its entry file with main, and may add pre and post scripts that run before and after the job's steps, which is how cleanup actions work. Because the runner does not install packages, the action's code is usually bundled into one file, for example with a tool such as ncc, and that file is committed. A Docker action names a Dockerfile or a prebuilt image, and can set an entrypoint and args; the workspace is mounted into the container, so files written there are visible to later steps. A composite action lists steps, and every run step in it must state its shell.
Inputs deserve one more note. In the metadata, an input can be required and can have a default, but required is not enforced by the runner: a missing required input does not stop the action from starting, so the action's own code should check. Inputs reach a JavaScript action through the toolkit's getInput function and reach a Docker action as environment variables named with an INPUT_ prefix.
Testing an action before release
The outline expects candidates to know how actions are tested as well as written. The usual pattern is a workflow in the action's own repository that runs on every pull request and uses the action from the working copy with uses: ./, so the change is exercised before it is released. A matrix across operating systems catches platform problems for JavaScript and composite actions, and unit tests cover the code itself. For a JavaScript action, a check that the committed bundle matches a fresh build stops a release where someone changed the source but forgot to rebuild. Lena had seen all three in Building Custom Actions and wrote them as a single flash card: test from the working copy, across platforms, with the bundle checked.
A README is part of the action too. Marketplace listings and callers rely on it for the inputs, outputs, required permissions and an example workflow. An action that needs a permission such as pull-requests: write should say so plainly, because the caller's workflow must grant it.
Versioning questions often hide a caller's point of view. A caller that uses a major tag such as v2 receives every compatible fix automatically and trusts the publisher to move the tag carefully. A caller that pins a full SHA receives nothing until it changes the pin, which is safer but needs a tool such as Dependabot to stay current. A caller that uses a branch name such as main receives every change, including breaking ones, and is the riskiest choice. When a question asks which reference a security-conscious organization should require, the SHA is the answer; when it asks which reference a publisher should document for convenience, the major tag usually is.
Common mistakes
MistakeChoosing a Docker action for something that must run on Windows.
InsteadDocker actions run only on Linux runners.
MistakeLeaving node_modules out of a JavaScript action without bundling.
InsteadCommit dependencies or a bundled dist file.
MistakeForgetting shell on composite run steps.
InsteadEvery run step in a composite action needs a shell.
MistakeReleasing a breaking change under the same major tag.
InsteadCreate a new major version and leave the old major tag in place.
MistakeMaking the floating major tag immutable.
InsteadKeep major tags as ordinary tags so they can move; make specific releases immutable.
Lena's practice for this domain was quick, because she had done most of it already. Her one gap was the Docker entry points: she had never written a post-entrypoint. She added a five-line cleanup script to a copy of pdf-proof in a test repository and watched it run after the main step.
Summary and key terms
- Actions is 15 to 20 of the exam: types, metadata and workflow commands, distribution and versioning.
- JavaScript actions use node24 and run on every runner; Docker actions run only on Linux; composite actions bundle steps and need a shell on run steps.
- Metadata declares inputs, outputs, runs and branding; inputs arrive as strings.
- Actions use the same environment files and commands as workflows, or the toolkit in JavaScript.
- Marketplace actions need a public repository, one root metadata file, a unique name, the developer agreement and two-factor authentication.
- Release full versions as immutable releases and move a major tag for compatible updates.
- action.yml
- The metadata file that defines an action's name, inputs, outputs and how it runs.
- node24
- The JavaScript runtime value for runs.using on current runners.
- Composite action
- An action whose runs section is a list of steps.
- Toolkit
- GitHub's JavaScript packages, such as @actions/core, for writing actions.
- Major version tag
- A tag such as v1 moved to the newest compatible release.
- Branding
- Metadata that sets an action's Marketplace icon and color.
Practice problems
Work each problem on paper first, then reveal the answer to check.
Which action type cannot run on a macOS runner?
Show answer
A Docker container action.
How does a composite action expose an output?
Show answer
By declaring it with a value that points at a step output.
Name two requirements for publishing to the Marketplace.
Show answer
Any two of: public repository, single metadata file at the root, unique name, accepting the developer agreement, two-factor authentication.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.