Use in CI¶
Run ycli in a pipeline to comment on an issue after a deploy, move it along its workflow or read a page. A pipeline needs three things: ycli itself, the two credentials as secrets, and commands that never wait for a person.
Credentials¶
Store YANDEX_ID_OAUTH_TOKEN and YANDEX_ID_ORGANIZATION_ID as secrets of the pipeline and expose them as environment variables of the job. The token is a person's OAuth token (see Authenticate). The working path for a pipeline today is an account created for automation: add a user to the organization for it, give that user only what the pipeline does, and issue its OAuth token.
A Yandex Cloud service account cannot stand in for that user. Yandex does not allow one for Wiki and Forms at all, and for Tracker only in a Yandex Cloud organization after a request to Yandex support. A ready IAM token of a user works in place of the OAuth token (YANDEX_CLOUD_IAM_TOKEN, see Authenticate), but it lives up to 12 hours, so it suits a job that issues one at its start, not a stored secret.
GitHub Actions¶
name: notify-tracker
on:
workflow_dispatch:
jobs:
comment:
runs-on: ubuntu-latest
env:
YANDEX_ID_OAUTH_TOKEN: ${{ secrets.YANDEX_ID_OAUTH_TOKEN }}
YANDEX_ID_ORGANIZATION_ID: ${{ secrets.YANDEX_ID_ORGANIZATION_ID }}
steps:
- uses: astral-sh/setup-uv@v10.2.0
- run: uvx yandex-cli==0.142.0 tracker comments create TRACKER-1 --text "Deployed ${GITHUB_SHA::7}"
uvx yandex-cli==<version> runs that version without installing anything else. Pin the version: a pipeline should not change behaviour when a new release comes out.
A ready-made GitHub Action is planned: follow #210.
GitLab CI¶
The image's entrypoint is ycli, so clear it to get a shell for script:
comment:
image:
name: ghcr.io/bim-ba/ycli:0.142.0
entrypoint: [""]
script:
- ycli tracker comments create TRACKER-1 --text "Deployed $CI_COMMIT_SHORT_SHA"
Set the two variables in Settings → CI/CD → Variables, masked.
Any other runner¶
With Docker, pass the variables by name so their values stay out of the command line:
docker run --rm -e YANDEX_ID_OAUTH_TOKEN -e YANDEX_ID_ORGANIZATION_ID \
ghcr.io/bim-ba/ycli:0.142.0 tracker comments create TRACKER-1 --text "Deployed"
Commands that do not wait¶
- Deletes and grants need
--yes. A command that destroys data, or that grants access (a role on a form or a page, permissions of a queue or an entity, an access binding, a licence or an embedding in DataLens), asks for confirmation; with no terminal it exits with code 2 instead. Pass--yeswhen the pipeline is meant to do it. The help of a command that grants access says so. - Output is JSON. Without a terminal ycli prints JSON, so
jqreads it:ycli tracker issues get TRACKER-1 | jq .key. - Try it first.
--dry-runprints the request a write would send and sends nothing.
Fail the job for the right reason¶
Each kind of failure has its own exit code. A pipeline usually retries a transient failure and stops on the rest:
ycli tracker comments create TRACKER-1 --text "Deployed" || status=$?
case "${status:-0}" in
0) ;;
5|6) echo "Tracker is busy or down, retry later"; exit 75 ;;
4) echo "The token is missing or rejected"; exit 1 ;;
*) exit "$status" ;;
esac
Checked on 2026-10-03: the Docker commands and the cleared entrypoint run against a real organization; the GitHub Actions and GitLab jobs were not run.