Skip to content

Commit

Permalink
Support linking PRs with tickets through comments [MDB-24383]
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Burmak committed Aug 13, 2023
1 parent 9c37057 commit f4f1284
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/link_startrek.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ name: Link with Startrek
on:
pull_request: { branches: [main] }

env:
ISSUE_PATTERN: '[A-Z]+-[0-9]+'

jobs:
link_with_startrek:
continue-on-error: true
link:
runs-on: ubuntu-latest
steps:
- name: parse_branch_name
id: parse_branch_name
- uses: actions/checkout@v3
- name: parse_issue
id: parse_issue
run: |
if [[ ${{ github.head_ref }} =~ ^([A-Za-z]+\-[0-9]+).*$ ]]; then
HEAD_COMMIT_MESSAGE="$(git show -s --format=%s HEAD)"
echo $HEAD_COMMIT_MESSAGE
if [[ "$HEAD_COMMIT_MESSAGE" =~ \[($ISSUE_PATTERN)\] || "${{ github.head_ref }}" =~ ^($ISSUE_PATTERN) ]]; then
echo issue_number="${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
fi
- name: link_issue
if: steps.parse_branch_name.outputs.issue_number
if: steps.parse_issue.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 }}'
url: 'https://st-api.yandex-team.ru/v2/issues/${{ steps.parse_issue.outputs.issue_number }}'
method: 'LINK'
customHeaders: >
{
Expand Down

0 comments on commit f4f1284

Please sign in to comment.