From 548adff9dc6e488601db007a22a15d8a7b75a2b4 Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Fri, 9 Apr 2021 15:03:53 +0900 Subject: [PATCH] docs: update examples --- docs/examples.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/examples.md b/docs/examples.md index 2db9429..3377f9a 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -21,6 +21,7 @@ - [Filtering push events](#filtering-push-events) - [Dynamic configuration using variables](#dynamic-configuration-using-variables) - [Setting the pull request body from a file](#setting-the-pull-request-body-from-a-file) + - [Using a markdown template](#using-a-markdown-template) - [Debugging GitHub Actions](#debugging-github-actions) @@ -560,6 +561,31 @@ The content must be [escaped to preserve newlines](https://github.community/t/se body: ${{ steps.get-pr-body.outputs.body }} ``` +### Using a markdown template + +In this example, a markdown template file is added to the repository at `.github/pull-request-template.md` with the following content. +``` +This is a test pull request template +Render template variables such as {{ .foo }} and {{ .bar }}. +``` + +The template is rendered using the [render-template](https://github.com/chuhlomin/render-template) action and the result is used to create the pull request. +```yml + - name: Render template + id: template + uses: chuhlomin/render-template@v1.2 + with: + template: .github/pull-request-template.md + vars: | + foo: this + bar: that + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + body: ${{ steps.template.outputs.result }} +``` + ### Debugging GitHub Actions #### Runner Diagnostic Logging