Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Exploration: From issue template to branches #435

Open
allejo opened this issue Jan 30, 2025 · 2 comments
Open

[Draft] Exploration: From issue template to branches #435

allejo opened this issue Jan 30, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@allejo
Copy link
Contributor

allejo commented Jan 30, 2025

I've been thinking of a little experiment to build. I want to try improving the process of adding resources to this repository. Right now, we're using Issue Templates to get the appropriate information from users. The format for issues created from templates are pretty standard. So as long as the user doesn't modify the issue contents too much, we can parse the issue body with something like GrantBirki/issue-template-parser.

steps:
  - name: Parse Issue
    id: parse-issue
    uses: GrantBirki/[email protected]
    with:
      body: ${{ github.event.issue.body }}

  - name: Output Issue JSON
    id: output-issue
    run: echo ${{ steps.issue-parser.outputs.json }}

This method isn't 100% reliable as manual edits or weird syntax could break this parsing method. However, if everyone plays nice, then this should be able to get the job done. I think it's a risk I'm willing to take.

Moving on, once we've parsed the issue body, the next task is to create a new branch with a new file inside of src/_resources. Next up, using the JSON from the parsed issue contents, we can now write a file with the filled in information.

title="${{ fromJSON(steps.parse-issue.outputs.json).title }}"
file_name=$(echo $title | tr '\s' '-')

cat <<EOF > src/_resources/case-study-$file_name.md
---
date: ...
title: $title
---
EOF

Now, this code could be written in Bash and let it be embedded in the workflow. Or we could also write this as a Python script in the repo and simply execute it from the workflow.

Lastly, you'd be able to use something like EndBug/add-and-commit to add and commit this file to the new branch.


What are your thoughts on investing time into building something like this?

@thekaveman
Copy link
Member

@allejo you literally read @vykster's mind!! We were just talking about this.

Yes please, go ahead and look into this.

@thekaveman thekaveman added the enhancement New feature or request label Jan 30, 2025
@thekaveman thekaveman moved this from Todo to Stretch in Digital Services Jan 30, 2025
@machikoyasuda
Copy link
Member

I approve of this message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Stretch
Development

No branches or pull requests

3 participants