Skip to content

Commit

Permalink
Add workflow to link startrek ticket (#24)
Browse files Browse the repository at this point in the history
* Add workflow to link startrek ticket

* Add ignoreStatusCodes to make link_startrek workflow idempotent
  • Loading branch information
aalexfvk authored Jul 23, 2023
1 parent b77e2ea commit 43e7460
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/link_startrek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: startrek link

on:
pull_request: { branches: [main] }

jobs:
link_with_startrek:
runs-on: ubuntu-latest
steps:
- name: parse_branch_name
id: parse_branch_name
run: |
if [[ ${{ github.head_ref }} =~ ^([A-Za-z]+\-[0-9]+).*$ ]]; then
echo issue_number="${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
fi
- name: link_issue
if: steps.parse_branch_name.outputs.issue_number
uses: fjogeleit/http-request-action@v1
with:
url: 'https://st-api.yandex-team.ru/v2/issues/${{ steps.parse_branch_name.outputs.issue_number }}'
method: 'LINK'
customHeaders: >
{
"Link": "<${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number }}>; rel=\"relates\"",
"Authorization": "OAuth ${{ secrets.OAUTH_STARTREK_TOKEN }}"
}
ignoreStatusCodes: '409'

0 comments on commit 43e7460

Please sign in to comment.