GitHub Actions Status Line

Sometimes, I see workflows that produce a little status line.

For example, the CodeQL workflow “duplicates” it’s status entry and shows a little bit of output:

Is it possible for me to do this myself? It would be cool if I could set my workflow up so it said something like “Lint errors found: src/index.ts line 5: @typescript-eslint/no-explicit-any, … and 5 more”

1 Like

This is done through the GitHub status API. I don’t think you can update the status of a workflow, since that is handled directly by GitHub Actions (but try it…I might be wrong).

Instead, you can create your own status by using the GitHub CLI like this in the workflow:

gh api -X POST "repos/$REPOSITORY/statuses/$SHA" \
            -f state="failure" \
            -f description="Lint errors found: src/index.ts line 5: @typescript-eslint/no-explicit-any" \
            -f context="My tslinting"

Read the full docs for all the details.