QGIS/.github/workflows/pr_to_doc_issue.yml
2020-01-06 11:00:14 +01:00

63 lines
2.6 KiB
YAML

name: Documentation issue for labeled PR
on:
pull_request:
types:
- closed
jobs:
pr2docissue:
if: github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'Needs Documentation')
runs-on: ubuntu-latest
name: Create issue on doc repo for labeled issue
steps:
# obfuscate the github token so it can be used on jobs triggered from forks
- name: Clear GH Token
id: token
uses: opengisch/clear-token@v1.0.12
with:
bot_token_encrypted: ddbdec32940df79f1adf2369b4b10f10b5a66f65
bot_token_xor_key: a1b2c3d47311f8e29e204f85a81b4df4a44e252c
# transform the milestone (e.g. 3.10.4) to a doc label (3.10)
- name: QGIS milestone to Doc label
id: milestone2label
env:
MILESTONE: ${{ github.event.pull_request.milestone.title }}
run: |
LABEL=$(sed -r 's/^([[:digit:]]\.[[:digit:]]+)(\.[[:digit:]]+)?$/\1/' <<< ${MILESTONE})
echo "Label: ${LABEL}""
echo "::set-output name=label::${LABEL}"
# create the documentation issue
- name: Create Documentation issue
id: doc_issue
uses: maxkomarychev/oction-create-issue@v0.7.1
with:
token: ${{ steps.token.outputs.token }}
owner: qgis
repo: QGIS-Documentation
title: ${{ format('Request in QGIS ({0})', github.event.pull_request.title) }}
# do not modify the QGIS version, an action automatically creates a label in the doc repo
# this is not possible to set labels directly due to security reasons
# the token is in clear, so no rights are given to qgis-bot
body: |
${{ format('Request for documentation in QGIS/qgis#{0})', github.event.pull_request.number) }}
${{ github.event.pull_request.title }}
QGIS version: ${{ steps.milestone2label.outputs.label }}
# write comment to ping the PR author
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ steps.token.outputs.token }}
issue-number: ${{ github.event.pull_request.number }}
body: |
@${{ github.event.pull_request.user.login }}
A documentation ticket has been opened at https://github.com/qgis/QGIS-Documentation/issue/${{ steps.doc_issue.outputs.number }}
It is **your** responsibility to visit this ticket and add as much detail as possible for the documentation team to correctly document this change.
Thank you!
reaction-type: 'rocket'