> ## Documentation Index
> Fetch the complete documentation index at: https://witness.nu/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Telling the project when you deploy

> A step in your deploy workflow that tells the cards its commits cite where they shipped.

A fix that is merged but not yet where a person can test it waits in **Blocked**, with the pull request as its reason. Nothing in witness knows when it reaches staging or production. Your pipeline does, and it can say so: a step at the end of your deploy workflow comments on every card the deployed commits cite, and moves the ones that were waiting.

## The step

Add it after the deploy has succeeded, once per environment you care about:

```yaml theme={null}
- uses: jobbin-ab/witness-deployed@v1
  if: success()
  with:
    link: ${{ secrets.WITNESS_LINK }}
    environment: staging
    url: https://staging.example.com
    status: verify
```

`link` is a share link to the project, from **Share** on the project page. An edit link lets the step move cards; a view link lets it comment only. It is the whole access, so it lives in a repository secret.

`environment` is where this deploy landed, in your team's words, and `url` is its address, so a person verifying can open it from the card.

`status` is where a waiting card goes. Leave it out and the step only comments.

`release` is the name your team calls this deploy by, when it has one: a release tag, a build number. A tester, support and the release notes say `v2.4.1`, not a commit, so it goes on the card beside the commit. A workflow that runs on a release has it to hand:

```yaml theme={null}
    release: ${{ github.event.release.tag_name }}
```

Each card the commits cite gets one comment, in the deploy's own name:

> Deployed to **staging** at `3f9c2a1` · run 4183 — [https://staging.example.com](https://staging.example.com)

The commit and the run are links, and the address is there when `url` is.

Beside the comment, the step records the deploy on the card: the environment, the commit, the release, the address and when, the latest per environment. That record is what the list reads. Every row shows the highest environment its card has reached, the filter bar offers **On** for each environment your deploys have named and **Not on** for the highest, and the card lists one line per environment. [Where the code has reached →](https://witness.nu/docs/concepts/cards.md#where-the-code-has-reached)

## What a deploy means is your rule

Witness does not decide what a deploy to an environment means. In one project a deploy to staging means a person can verify now; in another nothing is verifiable before production; in a third a deploy is worth a line on the card and no more. Say which in the project's [working rules](https://witness.nu/docs/guides/working-rules.md), so the agents know, and repeat it in the workflow, so the pipeline does the same: one step per environment, each with the status that deploy earns, or none.

Only a card in **Blocked** moves. A done card cited by a later hotfix stays done, and a card still being worked keeps its status; both get the comment. The step never sets **Done**: done carries the name of a person who vouches, and a pipeline has none to give. [Statuses →](https://witness.nu/docs/concepts/statuses.md)

## Which cards it finds

A commit cites a card by its id, `AL-04`, and only the project's own areas count: an id with another prefix, a Jira key say, is never mentioned. The commits are the ones since the previous deploy to the same environment from the same repository.

The project keeps that previous deploy. Every run of the step records which commit reached which environment, cards cited or not, and the next run compares from it. So the range is right however your deploys are triggered, a push to a branch, a tag per release, a manual run, and the step needs no checkout depth and no permission to read your workflow's runs. Before the project holds a record for an environment, on the first run after you add or upgrade the step, it compares from the previous successful run of the same workflow on the same branch when it can see one. With nothing to compare from at all, it reads the text alone when you pass one, otherwise the head commit, and says so in the step summary.

To compare from somewhere else, pass `since`, a commit, a tag or any ref GitHub can compare from. It wins over the record, and the deploy is recorded all the same.

A workflow that runs on a release, where the cards are named in the notes rather than in commits, hands the notes to the step as `text`, and they are read by the same rule beside the commits:

```yaml theme={null}
    text: ${{ github.event.release.body }}
```

When the commit that shipped is not the one the workflow runs on, a build promoted from an earlier run, a chosen ref, a rollback, pass it as `sha`.

## What it never does

It never fails your deploy. A project the link cannot reach is a warning on the step and nothing is written. A card the server refuses to change is a line in the step summary saying why, beside the cards it reached. The job stays green in every case, and the link appears nowhere in the summary or the log.

## From any other CI

The step is a handful of calls on the link, and the link answers with its own contract. One of them is the project's deploy record: `POST /deploys` after every deploy, cards cited or none, which answers with the deploy before it, where the next range begins. Fetch the contract with anything that is not a browser and read the calls under *Working with cards*:

```bash theme={null}
curl --fail-with-body -s "$WITNESS_LINK"
```

The source is [jobbin-ab/witness-deployed](https://github.com/jobbin-ab/witness-deployed).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.