DOC-6968 Omit a clients-example tab when that client lacks the requested step #1447
Workflow file for this run
This file contains hidden or 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: autocomment_jira_link | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| jobs: | |
| auto-comment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 'Checkout' | |
| uses: 'actions/checkout@v3' | |
| - name: Create Comment | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| BRANCH_NAME: ${{ github.event.pull_request.head.ref }} | |
| run: | | |
| generate_post_data() | |
| { | |
| cat <<EOF | |
| { | |
| "body": "$COMMENT" | |
| EOF | |
| } | |
| if [[ "$BRANCH_NAME" == DOC-* ]]; then | |
| CREATE_COMMENT_URL="https://api.github.com/repos/${REPO}/issues/${PR_NUMBER}/comments" | |
| JIRA_TICKET=$(grep -Eo '^DOC-[0-9]+' <<< "$BRANCH_NAME") | |
| JIRA_LINK="https://redislabs.atlassian.net/browse/${JIRA_TICKET}" | |
| COMMENT="[${JIRA_TICKET}](${JIRA_LINK})" | |
| # Write comment on pull request | |
| curl -Ls \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| $CREATE_COMMENT_URL \ | |
| --data "$(generate_post_data)" 1>/dev/null | |
| printf '%s\n' 'Comment written!' | |
| fi |