project Utilities / Gitlab Recurring Issue avatar

utilities/gitlab_recurring_issue#12: Template directory



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.1
Created: 10-Sep-24 18:46



Description

At the moment, ticket descriptions are provided via the YAML config.

That's fine for short ticket descriptions, but short descriptions are the devil. Although it's possible to include longer descriptions in YAML it could quite quickly get unwieldy.

I'd like to add a description_file attribute to ticket config - this would provide the name of a file which contains the desired description for that ticket.

All template files should be under a well-known directory, and would be read in as plain text.



Toggle State Changes

Activity


assigned to @btasker

verified

mentioned in commit b2ad4c24256b5b33fe1fdc4a2e10bd5d100d3920

Commit: b2ad4c24256b5b33fe1fdc4a2e10bd5d100d3920 
Author: B Tasker                            
                            
Date: 2024-09-10T20:01:24.000+01:00 

Message

feat: implement support for loading ticket descriptions from file (utilities/gitlab_recurring_issue#12)

+55 -3 (58 lines changed)

Using the word "template" is probably setting expectations a little higher than we've achieved here (but is representative of where we eventually want to get). Currently there's no subsitution at all - whatever is in the file will be written into Gitlab, verbatim.

The description_file attribute can be used on a ticket config to specify a file to read and use as the description.

That file must have the suffix .template, if it's missing it'll be appended - the idea being to make sure a misconfig doesn't lead to someone have /etc/shadow written into a ticket or other similar horrors.

The file should be within the templates dir - that defaults to /templates but can be overridden in env var TEMPLATE_DIR.

tickets:
   - title: "Test Issue"
     active: true
     description_file: test.template
     due_in_days: 7
     schedule:
       every: run
     description: "This is a test issue"
     project: misc/test_proj
     assignee: btasker
     labels: ["task", "foobar"]