Skip to content

Commit

Permalink
Create issues.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
simskij authored Jun 21, 2022
1 parent 4511de7 commit 7817ba9
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Issues

on: [issues]

jobs:
update:
name: Update Issue
runs-on: ubuntu-latest
steps:
- name: Dump Github Context
run: |
echo '${{ toJSON(github) }}'
echo "update=false" >> $GITHUB_ENV
if [ ${{ github.event_name }} != "issues" ]; then
echo "This action only operates on issues"
exit 0
fi
echo "update=true" >> $GITHUB_ENV
- name: Determine action
run: |
if [ ${{ github.event.action }} == "opened" ]; then
echo "action=open" >> $GITHUB_ENV
fi
if [ ${{ github.event.action }} == "reopened" ]; then
echo "action=reopen" >> $GITHUB_ENV
fi
if [ ${{ github.event.action }} == "closed" ]; then
echo "action=close" >> $GITHUB_ENV
fi
- name: Determine type
run: |
if ${{ contains(github.event.*.labels.*.name, 'Type: Bug') }}; then
echo "type=bug" >> $GITHUB_ENV
else
echo "type=story" >> $GITHUB_ENV
fi
- name: Update
if: ${{ env.update == 'true' }}
run: |
id="${{ github.event.issue.html_url }}"
title="${{ github.event.issue.title }}"
component="nrpe_exporter"
description="Opened by ${{ github.event.issue.user.login }}."
data=$(jq -n \
--arg id "$id" \
--arg action "${{ env.action }}" \
--arg title "$title" \
--arg description "$description" \
--arg component "$component" \
--arg type "${{ env.type }}" \
'{data: {id: $id, action: $action, title: $title, description: $description, component: $component, type: $type}}')
curl -X POST -H 'Content-type: application/json' --data "${data}" "${{ secrets.JIRA_URL }}"

0 comments on commit 7817ba9

Please sign in to comment.