Add external run action test-integration #210
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Link with Startrek | |
on: | |
pull_request: { branches: [main] } | |
env: | |
ISSUE_PATTERN: '[A-Z]+-[0-9]+' | |
jobs: | |
link: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Parse issue ID | |
run: | | |
LAST_COMMIT_MESSAGE="$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${{ github.event.pull_request.commits_url }}" | jq -r .[-1].commit.message)" | |
if [[ "$LAST_COMMIT_MESSAGE" =~ \[($ISSUE_PATTERN)\] || "${{ github.head_ref }}" =~ ^($ISSUE_PATTERN) ]]; then | |
echo ISSUE_NUMBER="${BASH_REMATCH[1]}" >> "${GITHUB_ENV}" | |
fi | |
- name: Link issue | |
if: env.ISSUE_NUMBER | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://st-api.yandex-team.ru/v2/issues/${{ env.ISSUE_NUMBER }}' | |
method: 'LINK' | |
customHeaders: > | |
{ | |
"Link": "<${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.number }}>; rel=\"relates\"", | |
"Authorization": "OAuth ${{ secrets.OAUTH_STARTREK }}" | |
} | |
ignoreStatusCodes: 409 |