jinja2-action icon indicating copy to clipboard operation
jinja2-action copied to clipboard

Add support for templating without the need for files

Open allejo opened this issue 6 months ago • 0 comments

I want to propose adding support for compiling templates without needing files. An example use case would be something along the lines of this,

- id: pr-message
  name: Create PR Message
  uses: cuchi/[email protected]
  with:
    template_str: |
      Hello! You've created a PR that has {{ num_files_touched }} files changed!

      {% for file in files %}
        - {{ file }}
      {% endfor %}
    strict: true
    variables: |
      files=...
      num_files_touched=30
- name: Create PR
  uses: peter-evans/create-pull-request@v5
  with:
    body: ${{ steps.pr-message.outputs.contents }}

Would this be feasible? A major version bump might be necessary since template and output_file will no longer be required. If output_file is omitted, it saves the contents to the step's outputs. Thoughts on the proposal?

allejo avatar Dec 19 '23 05:12 allejo