Buckets:
| name: "Zuke Build" | |
| description: "Harden the runner, check out the repository, and run a Zuke target." | |
| branding: | |
| icon: terminal | |
| color: purple | |
| # This file is the repository's pinned-action manifest, and the one YAML here | |
| # that is *not* generated — deliberately, because that is what removes a | |
| # circularity. Dependabot scans `.github/workflows` and a root `action.yml`, and | |
| # nothing else; it bumps the SHAs below and the `# vX.Y.Z` beside each one. | |
| # `build/action_pins.ts` reads them, and the workflow generator writes its files | |
| # from them. So the flow is one-directional: a bot edits this file, the generator | |
| # reads it, and no generated file is ever the source of its own pins. | |
| # | |
| # It is also a usable composite action in its own right, published to the GitHub | |
| # Marketplace. A repository that builds with Zuke can make this its first step — | |
| # `uses: zuke-build/zuke@<sha>` needs no prior checkout, since a remote action is | |
| # fetched by the runner. That is how this repository's own generated workflows | |
| # now start, so the action is exercised on every run here rather than only by | |
| # strangers. It is the remote form that makes that possible: `uses: ./` resolves | |
| # inside the workspace and would need the very checkout this is meant to | |
| # precede, which is why the workflows inlined these steps until it was | |
| # published. Their pin comes from `build/action_version.json`, since this file | |
| # cannot pin the action to itself. | |
| # | |
| # The action is versioned by a plain `v1` tag (and the `v1.x.y` it points at), | |
| # which is the tag consumers write. That namespace is the action's alone: the | |
| # packages release under component tags (`core-v1.9.0`, `cli-v1.0.0`, …) via | |
| # release-please, which has no root package, so `v1` here means this action and | |
| # never "Zuke 1.0". | |
| inputs: | |
| target: | |
| description: "The Zuke target to run. Omit to harden and check out only." | |
| required: false | |
| default: "" | |
| egress-policy: | |
| description: "harden-runner policy: `audit` to record, `block` to enforce. Note this defaults to `audit`; harden-runner's own default is `block`." | |
| required: false | |
| default: "audit" | |
| allowed-endpoints: | |
| description: "Space-separated `host:port` list permitted under `block`." | |
| required: false | |
| default: "" | |
| persist-credentials: | |
| description: "Leave the token in git config, for a later push." | |
| required: false | |
| default: "false" | |
| fetch-depth: | |
| description: "Commits to fetch. `0` is the full history, which a secret scan needs." | |
| required: false | |
| default: "1" | |
| ref: | |
| description: "Branch, tag or SHA to check out. Leave it empty — the default — and the checkout follows the event, which on an event whose content a contributor writes (`pull_request_target`, `issue_comment`, `workflow_run`, …) is the base or default branch: code that is already trusted. Setting it is what those events refuse, because a ref chosen from a contributor's text would run with this repository's secrets — see the refusal below." | |
| required: false | |
| default: "" | |
| deno-version: | |
| description: "Install this Deno instead of letting the ./zuke launcher bootstrap one." | |
| required: false | |
| default: "" | |
| actions-cache: | |
| description: "Expose the Actions cache service to the build, so Zuke's remote cache shares target outputs through it (see docs/caching.md)." | |
| required: false | |
| default: "false" | |
| runs: | |
| using: composite | |
| steps: | |
| # First, before any other step: the point of an egress policy is to be in | |
| # place before anything it governs runs. | |
| - name: Harden the runner | |
| uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 | |
| with: | |
| egress-policy: ${{ inputs.egress-policy }} | |
| allowed-endpoints: ${{ inputs.allowed-endpoints }} | |
| # `ref` puts something other than the event's own commit in the workspace. | |
| # On an event whose trigger is written by anyone who can open a pull | |
| # request, a comment or a discussion, that something is attacker-controlled | |
| # — and those events run with the base repository's secrets and a writable | |
| # token. Checking that code out is already the whole bug: what executes it | |
| # afterwards need not be this action. A caller who omits `target` and writes | |
| # `run: ./zuke ci` in the next step of their own job gets exactly the same | |
| # outcome, so keying the refusal on `target` would guard one spelling of the | |
| # mistake rather than the mistake. | |
| # | |
| # Hence: the refusal ignores `target`, and names the events rather than the | |
| # steps. It is an allowlist, not a denylist, because a denylist of the | |
| # events that are dangerous today is wrong the moment GitHub adds one — | |
| # and the failure is silent, since the guard simply does not fire. Listing | |
| # the events where the ref can only come from someone who can already push | |
| # means anything unrecognised is refused instead. | |
| # | |
| # Why each of these is safe: `pull_request` gives a fork no secrets and a | |
| # read-only token; `push` and `merge_group` require write access; | |
| # `workflow_dispatch`, `schedule` and `release` are triggered by someone | |
| # who could push the same code directly. Everything else — `issue_comment` | |
| # and the `/build` slash-command pattern, `workflow_run`, | |
| # `pull_request_target`, the discussion and review events — lets a | |
| # contributor's text choose what gets checked out while the job holds this | |
| # repository's secrets. | |
| - name: Refuse an untrusted checkout on a secret-bearing event | |
| if: >- | |
| inputs.ref != '' && !contains(fromJSON('[ | |
| "pull_request", "push", "merge_group", | |
| "workflow_dispatch", "schedule", "release" | |
| ]'), github.event_name) | |
| shell: bash | |
| # Through the environment, not the script text — the same rule the run | |
| # step below follows, and worth following even for a value GitHub picks | |
| # from a fixed set. | |
| env: | |
| ZUKE_EVENT: ${{ github.event_name }} | |
| run: | | |
| echo "::error::Refusing to check out a custom ref on a $ZUKE_EVENT event: it runs with this repository's secrets and a writable token, so checking out a ref a contributor controls hands them both. Use 'pull_request', or drop the 'ref' input." | |
| exit 1 | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: ${{ inputs.persist-credentials }} | |
| fetch-depth: ${{ inputs.fetch-depth }} | |
| ref: ${{ inputs.ref }} | |
| # Only when asked. The ./zuke launcher bootstraps a pinned Deno itself, so | |
| # this is for a job that runs `deno` directly instead of through it. | |
| - name: Set up Deno | |
| if: inputs.deno-version != '' | |
| uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5 | |
| with: | |
| deno-version: ${{ inputs.deno-version }} | |
| # The cache service's token and URL reach a JavaScript action's process and | |
| # nothing else — not a `run:` step, and not this composite's own shell — so | |
| # one exports them to the job for the build's `envCacheStore` to find (see | |
| # GitHubActionsCacheStore in @zuke/core). The token is registered as a | |
| # secret first: exporting it puts it where a later `env` dump would print it. | |
| - name: Expose the Actions cache to the build | |
| if: inputs.actions-cache == 'true' | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| core.setSecret(process.env.ACTIONS_RUNTIME_TOKEN); | |
| core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env.ACTIONS_RUNTIME_TOKEN); | |
| core.exportVariable("ACTIONS_RESULTS_URL", process.env.ACTIONS_RESULTS_URL); | |
| # The target rides in through the environment and is quoted in the shell, | |
| # rather than being interpolated into the script text. Expanding | |
| # `${{ inputs.target }}` there would splice a caller's string straight into | |
| # the command — and a caller who derives that value from something untrusted, | |
| # a pull-request title say, would be handing arbitrary code to this action. | |
| # An env var is a value; template expansion is code. | |
| - name: Run the Zuke target | |
| if: inputs.target != '' | |
| shell: bash | |
| env: | |
| ZUKE_TARGET: ${{ inputs.target }} | |
| run: | | |
| if [ ! -f ./zuke ]; then | |
| echo "::error::No ./zuke launcher in this repository. Scaffold one with 'deno install -A -g -n zuke jsr:@zuke/cli' then 'zuke setup', and commit what it writes: https://github.com/zuke-build/zuke#install" | |
| exit 1 | |
| fi | |
| ./zuke "$ZUKE_TARGET" | |
Xet Storage Details
- Size:
- 8.6 kB
- Xet hash:
- 2dcb2cf36e8f9d126aca4d11f8b5572fff204eb80e04e9918a3409ebeba95582
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.