diff --git a/.github/workflows/autocomment_jira_link.yaml b/.github/workflows/autocomment_jira_link.yaml new file mode 100644 index 000000000..ba526ad15 --- /dev/null +++ b/.github/workflows/autocomment_jira_link.yaml @@ -0,0 +1,54 @@ +name: autocomment_jira_link + +on: + pull_request: + paths: + - 'content/**' + 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: | + set -e + + 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})" + + generate_post_data() + { + cat </dev/null + + printf '%s\n' 'Comment written!' + fi \ No newline at end of file