Skip to content

Commit

Permalink
debug: multiline input
Browse files Browse the repository at this point in the history
  • Loading branch information
chuhlomin committed Nov 21, 2023
1 parent 0ca0022 commit d0853ab
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: test

on:
push:
branches:
- test

env:
DOCKER_IMAGE: chuhlomin/render-template

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: PR Features
id: pr_features
run: |
FEATURE_COMMITS=$(git log --oneline --pretty=format:"%s" | grep -E '^(feat!|feat|fix|docs)'')
echo "${FEATURE_COMMITS}"
{
echo 'pr_features<<EOF'
echo "${FEATURE_COMMITS}"
echo EOF
} >> $GITHUB_OUTPUT
- name: PR Notes
id: pr_notes
run: |
COMMIT_BODIES=$(git log --pretty=format:"%s%n%b" | awk '/^(feat!|feat|fix|docs)/ {inBody=1; next} inBody {print $0; next} {inBody=0}' | sed G)
echo "${COMMIT_BODIES}"
{
echo 'pr_notes<<EOF'
echo "${COMMIT_BODIES}"
echo EOF
} >> $GITHUB_OUTPUT
- name: Get Current Date
id: get_current_date
run: |
CURRENT_DATE=$(date +"%Y-%m-%d")
echo "current_date=${CURRENT_DATE}" >> $GITHUB_OUTPUT
- name: Test action
uses: ./ # Uses an action in the root directory
id: render
with:
template: ./testdata/pull_request_template.md
vars: |
pr_date: ${{ steps.get_current_date.outputs.current_date }}
pr_feature: "${{ steps.pr_features.outputs.pr_features }}"
pr_notes: "${{ steps.pr_notes.outputs.pr_notes }}"
- name: Get `result` output
run: echo "${{ steps.render.outputs.result }}"
11 changes: 11 additions & 0 deletions testdata/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<h2>🤖 Reg created a pull request <em>beep boop</em></h2>

<h3>{{ .pr_date | date "2006-01-02" }}</h3>

<h3>Features</h3>

{{ .pr_feature }}

<h3>Notes</h3>

{{ .pr_notes }}

0 comments on commit d0853ab

Please sign in to comment.