create-an-issue icon indicating copy to clipboard operation
create-an-issue copied to clipboard

Add support for mustache templates to assignees

Open epiekarski opened this issue 2 years ago • 5 comments

Similar to #119 would it be possible to add support for mustache templates for assignees?

I'm creating a process that automatically assigns a member from my team to an issue by passing the gh user as an environment variable. Maybe I'm missing some existing functionality that might already accomplish this?

This is my current issue_template header:

---
title: Update-stale-article-{{ env.ARTICLE }}
assignees: {{ env.ASSIGNEE }}
labels: article-maintenance
---

This fails with: Error: An error occurred while creating the issue. This might be caused by a malformed issue title, or a typo in the labels or assignees. Check .github/ISSUE_TEMPLATE.md!

In the logs, I can see

title: 'Update-stale-article-{{ env.ARTICLE }}',
assignees: { '[object Object]': null },
labels: 'article-maintenance'

but I know that the env.ASSIGNEE variable has a value because it is used in the body of the issue as well and populates without a problem.

epiekarski avatar May 26 '22 03:05 epiekarski

Came here for that 👍

melMass avatar May 26 '22 19:05 melMass

@epiekarski the template does not let you use env vars, but you can just set the assignees directly in the action's yaml file:

        with:
          assignees: {{ env.ASSIGNEE }}

funes79 avatar Jun 20 '22 11:06 funes79

Please contribute to an active fork! https://github.com/dblock/create-a-github-issue

dblock avatar Sep 01 '22 16:09 dblock

@JasonEtco are you planning to support template for labels? I know that @dblock forked and implemented it but on the other hand releasing 2.8.1 I see you are active in this repo. Thanks

funes79 avatar Dec 02 '22 15:12 funes79

Hey folks - I'm fine with support templates for labels, assignees, and anything else. PRs welcome! It'd have to look similar to how we're doing the title templating:

https://github.com/JasonEtco/create-an-issue/blob/4cc79e46650462b59761133ac18126b98c5e8a60/src/action.ts#L81-L84

That said: you should be able to use the assignees input already: https://github.com/JasonEtco/create-an-issue#inputs

There's not an input for labels, but again I'd be happy to review a PR to add that support 👍

JasonEtco avatar Dec 23 '22 06:12 JasonEtco