Automating status changes on the Yandex Tracker board
Read an article on Yandex-tracker-action action that allows you to automatically move tasks on the Yandex Tracker board.
Yandex Tracker is similar to Jira service, in that it’s used for collaborating on projects and managing processes within a company. Companies use Yandex Tracker to structure and implement projects, such as developing apps, running ad campaigns, processing user requests, approving contracts, and more. Yandex Tracker enables managers to distribute work among team members and track their progress, and it also helps employees keep track of their tasks, deadlines, and priorities.
At the moment, Yandex Tracker can not automatically move tasks around the board, so you have to move tasks yourself, which is not always convenient. For example, a developer can push a commit and open a pull request, but then they have to go to Yandex Tracker and manually change that task’s status to, for example, “For Review”.
Evrone has a team working on an internal ERP project, and they started to wonder if this process could be automated. The first idea that came to mind to solve this problem was to write an action in the Github pipeline, since, at the moment, there are no alternatives to this Github action. Yandex Tracker has an API which you can send requests to, like, “Move the task to another state”.
So this is what Yandex-tracker-action does. No magic — it just communicates with the Yandex API under the hood and moves the task. Now when we open a pull request, we have an action running that moves the task. When we close the pull request and merge it, the task also moves to the “Merged” status.
How does Yandex-tracker-action work?
By default, it parses commits of the form "[RI-1] implement something
" and takes the task number, which in this case is RI-1
. You can also set tasks directly in the action, for example, by specifying the output from the previous job.
If there are multiple commits with different task keys in the pull request, they will all be moved on the board. It is also possible to specify multiple tasks in an action. All task keys will be collected, both specified in the action and found in the commits.
If the task key is not found in the tracker, you will receive a warning, but the tasks found will be processed. If the task has nowhere to move or it is already in the desired status, a message will be displayed.
Basic usage
By default, commit messages such as "[RI-1] awesome-feature
" will be parsed, where "RI-1
" will be the feature key. You can specify a specific task key, and you can also use the logic from the previous job step.
name: YC Tracker
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
transit-tasks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Move Task When PR Opened
if: github.event.action != 'closed'
uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
task_url: true
ignore: ERP-31,ERP-32
- name: Move Task When PR Merged
if: github.event.pull_request.merged == true
uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
task_url: true
ignore: ERP-31,ERP-32
Add specific task key
You can specify task numbers, separated by commas.
- uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
tasks: RI-218 # or RI-218,RI-11
Add ignore tasks
You may need to ignore some long-lifecycle tasks. If you have long-running tasks that you do not want to automatically move, then you can ignore them. Multiple tasks should be separated by commas.
- uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
ignore: RI-1 # or RI-1,DI-8
Comment PR with task url
If true — a comment will be set to the current PR with the task address of the form in the PR description.
- uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
task_url: true
Get all available transitions
By default, if the PR is open, the task will go into the in_review
state. If the PRs are merged, the state is resolve
. You can specify a human readable name or endpoint name.
Get all available states:
curl -H "Authorization: OAuth <oauth2-token>" -H "X-Org-ID: <org-id>" -H "Content-Type: application/json" https://api.tracker.yandex.net/v2/issues/<task-key>/transitions | jq ".[].id"
See output of the action and find states:
- uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
to: 'На ревью' # or 'in_review'
One move if PR is opened and one move if it is merged
You can move an issue when opening a PR and when merging a PR into different transitions. See default state names above.
- name: Move Task When PR Opened
if: github.event.action != 'closed'
uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
to: 'in_review'
- name: Move Task When PR Merged
if: github.event.pull_request.merged == true
uses: evrone-erp/yandex-tracker-action@v1
with:
token: ${{secrets.GITHUB_TOKEN}}
yandex_org_id: ${{ secrets.YANDEX_ORG_ID }}
yandex_oauth2_token: ${{ secrets.YANDEX_OAUTH2_TOKEN }}
to: 'merged'
Future plans
The development of Yandex-tracker-action began quite recently and is still in progress, but we would ultimately like to include additional options that other companies may need. Therefore, in the near future, we plan to release a new implementation and use the Yandex-tracker-action on client projects.
Each company has its own business processes, and the actions should be tailored for each business’s desired statuses. For example, when we open a pull request, we move the task to the “For Review” state, but perhaps another company has this process built differently and they move the task to a different field.
We plan to provide for such cases in the new implementation and make it so that the user can specify, for example, several transitions between statuses. In which case, our action will look to see if it can move the task to the first status, or if it can move to the second, and so on. If it can’t move the task to any of the listed statuses, it will simply display a list of available transitions.
If you’re looking for a tool to automate your business processes, we can help you develop a useful solution — in Yandex or in another product or service. Just send us a message using the form below, and we will contact you to discuss the details and see how we can partner with you to develop a useful project together.