Skip to content

Commit

Permalink
add 56-issue-form workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Falourd <[email protected]>
  • Loading branch information
GuillaumeFalourd committed Aug 29, 2022
1 parent adf02da commit 710262a
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Test"
description: Test
title: "Test"
labels: ["test1","test2"]
assignees:
- ${{github.author}}
body:
- type: markdown
attributes:
value: |
Formulário padrão
- type: input
id: name
attributes:
label: ">>Name<<"
description: Name
placeholder: myname
validations:
required: true

- type: dropdown
id: template
attributes:
label: ">>Template<<"
description: Select an option
options:
- option1
- option2
- option3

validations:
required: true
66 changes: 66 additions & 0 deletions .github/workflows/56-issue-form.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Issue Form

on:
issues:
types: [opened, reopened]

jobs:
comment:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.issue.labels.*.name, 'urbancode') && !contains(github.event.issue.labels.*.name, 'stackspot') }}
steps:
- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: |
Follow the run through: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
reactions: '+1'

form-to-json:
name: Convert Form Issue to JSON
runs-on: ubuntu-latest
needs: [comment]
outputs:
payload-parsed: ${{ steps.payload.outputs.json_var }}
steps:
- name: Run Issue form parser
id: parse
uses: peter-murray/[email protected]
with:
issue_id: ${{ github.event.issue.number }}
separator: '###'
label_marker_start: '>>'
label_marker_end: '<<'

- name: Set output
id: payload
run: echo ::set-output name=json_var::'${{ steps.parse.outputs.payload }}'

- name: Show output
run: echo "${{ toJson(steps.payload.outputs.json_var) }}"

test:
runs-on: ubuntu-latest
needs: [form-to-json]
steps:
- name: Test echo form fields
run: |
echo ${{ fromJson(needs.form-to-json.outputs.payload-parsed)['Name'] }}
echo ${{ fromJson(needs.form-to-json.outputs.payload-parsed)['Template'] }}
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"

auto-closing-issue:
needs: [test]
name: Auto-closing Issue
runs-on: ubuntu-latest
steps:
- name: Close Issue
id: parse
uses: peter-evans/close-issue@v1
with:
issue-number: ${{ github.event.issue.number }}
comment: Close automatically through https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

0 comments on commit 710262a

Please sign in to comment.