Checks GitHub issue bodies and comments for OTRS Urls. Found OTRS Urls will be formatted with Markdown and the OTRS ticket will be notified via a note that an issue has linked to this ticket. Also a (configurable) label will be added to the issue. Another notification will be sent out when an issue referencing a ticket is closed.
Attention This action is suited for our needs at @tangro. There is a high possibility that it won't work for you. Reach out to us if you're interested in using it in your workflows.
name: Check for OTRS Ticket Urls
on:
issues:
types: [opened, edited, closed]
issue_comment:
types: [created, edited]
jobs:
otrs:
name: Check for OTRS tickets
runs-on: ubuntu-latest
steps:
- name: Check for OTRS tickets
uses: tangro/[email protected]
env:
OTRS_USERNAME: ${{ secrets.OTRS_USERNAME }}
OTRS_PASSWORD: ${{ secrets.OTRS_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_CONTEXT: ${{ toJson(github) }}
with:
label: 'Ticket'
otrs-url: 'https://{URL_TO_OTRS}/otrs/index.pl'
otrs-url-regex: 'https://{URL_TO_OTRS}/otrs/index.pl'
otrs-url-rest: 'https://{URL_TO_OTRS}/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST'
Attention Do not forget to pass the
GITHUB_TOKEN
, theGITHUB_CONTEXT
theOTRS_USERNAME
and theOTRS_PASSWORD
viaenv
variables. TheOTRS_USERNAME
andOTRS_PASSWORD
have to be added to the secrets configuration.
Steps the example job will perform:
- Only act when an issue body gets created, edited or closed or an issue comment gets created or edited
- Run the action which will check the text and works its magic
The action will only run on events issues and issue_comment so make sure that your workflow only runs on those, too. Also you'll need a user inside OTRS with the sufficient rights to read issues and post notes. The credentials of this user have to be saved in the secret configuration under OTRS_USERNAME
and OTRS_PASSWORD
.
label
- The action will automatically add a label when a ticket URL has been found. By default it will add aTicket
label. You can set a different label here.otrs-url
- The URL the formatted links to the ticket will useotrs-url-regex
- In our case we have an internal and external URL to reach our OTRS. It looks something like this:https://(internal|external).xxx.xx/otrs/index.pl
otrs-url-rest
- The url to the OTRS REST API
Follow the guide of the tangro-actions-template