Skip to content

Verify cluster creation options for dask_gateway works #73

Verify cluster creation options for dask_gateway works

Verify cluster creation options for dask_gateway works #73

# Inspired from https://stefanbuck.com/blog/codeless-contributions-with-github-issue-forms
name: Comment on issues with `new hub` label that are requesting a deployment with the pending information
on:
issues:
types:
- labeled
jobs:
ask-for-pending-information:
if: github.event.label.name == 'new hub'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v4
- name: Parse new hub request issue template form
uses: stefanbuck/github-issue-praser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/2_new-hub-provide-info.yml
- name: Find missing info in form
shell: python
id: find-missing-info
run: |
import os
form = ${{ steps.issue-parser.outputs.jsonString }}
# This will hold a string with all the pending information in the form
pending_info = ""
community_rep = form.get("community_representative_handle", None)
# Parse the form entries
for form_entry_id, form_entry_value in form.items():
# Add the form entry ids that were empty or marked as pending
# to a string separated by `<br>-`
# where <br> is HTML line break for a better readability when rendered.
if (
form_entry_id != "tasks_to_deploy"
and "optional" not in form_entry_id
and (not form_entry_value or form_entry_value == "pending")
):
# Form ids have `_` in them, so replace their occurrences with a space
# to improve readability
pending_info += f'- {form_entry_id.replace("_", " ")}<br>'
# Export the `pending_info` string to GITHUB_OUTPUT to be used in following steps
with open(os.environ["GITHUB_OUTPUT"], "a") as f :
print(f"pending_info={pending_info}", file=f)
print(f"community_rep={community_rep}", file=f)
- name: Render comment template using information from the `find-missing-info` step before
id: template
uses: chuhlomin/[email protected]
with:
template: .github/comment-templates/comment-pending-deployment-info.md
vars: |
pending_info: "${{ steps.find-missing-info.outputs.pending_info }}"
community_rep: "${{ steps.find-missing-info.outputs.community_rep }}"
issue_author: "${{ github.event.issue.user.login }}"
- name: Create comment
if: ${{ steps.find-missing-info.outputs.pending_info }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: ${{ steps.template.outputs.result }}