Skip to content

Commit 8ef3886

Browse files
committed
test filename
1 parent 1853127 commit 8ef3886

2 files changed

Lines changed: 37 additions & 6 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
inputs:
55
post_title:
66
description: 'Used for filename and post.sh name. The space will be replaced by `-` inv the file name.'
7-
default: 'Event#'
7+
default: ''
88
required: true
99
post_body:
1010
description: 'Use GitHub MD format'
@@ -25,7 +25,6 @@ jobs:
2525

2626
env:
2727
FILENAME_PREFIX: ./_posts/$(date +'%Y-%m-%d')-$( echo '${{ github.event.inputs.post_title }}' | sed -r 's/[# ]+/-/g' ).md
28-
FILENAME: ./_posts/$(date +'%Y-%m-%d')-$( echo '${{ github.event.inputs.post_title }}' | sed -r 's/[# ]+/-/g' ).md
2928
MESSAGE: ${{ github.event.inputs.post_body }}
3029
POST: |
3130
---
@@ -46,8 +45,25 @@ jobs:
4645
- name: Calculate event number
4746
run: |
4847
lastEvent=$(ls -LR1 | sed -E 's/[0-9]{4}-[0-9]{2}-[0-9]{2}-//;s/Event-//;s/-.*//;s/.md//' | sort -n | tail -1)
49-
echo "next_event=$((lastEvent+1))" >> $GITHUB_ENV
50-
echo "FILENAME=$((lastEvent+1))" >> $GITHUB_ENV
48+
nextEvent=$((lastEvent+1))
49+
filename=$( echo "Event-$nextEvent-${{ github.event.inputs.post_title }}" | sed -r 's/[ ]+/-/g' ).md
50+
echo "next_event=$nextEvent" >> $GITHUB_ENV
51+
echo "FILENAME=${{ env.FILENAME_PREFIX }}${filename}" >> $GITHUB_ENV
52+
53+
- name: Create post
54+
run: |
55+
echo 'POST<<EOF' >> $GITHUB_ENV
56+
echo '---' >> $GITHUB_ENV
57+
echo 'layout: post' >> $GITHUB_ENV
58+
echo 'title: \"${{ github.event.inputs.post_title }}\"' >> $GITHUB_ENV
59+
echo 'image: /images/default.jpg' >> $GITHUB_ENV
60+
echo 'tags: [${{ github.event.inputs.tags }}]' >> $GITHUB_ENV
61+
echo 'date: $(date +'%Y-%m-%d %H:%M:%S %z')' >> $GITHUB_ENV
62+
echo 'video: ' >> $GITHUB_ENV
63+
echo '---' >> $GITHUB_ENV
64+
echo '' >> $GITHUB_ENV
65+
echo '${{ github.event.inputs.post_body }}' >> $GITHUB_ENV
66+
echo 'EOF' >> $GITHUB_ENV
5167
5268
- name: Create post file
5369
run: |
@@ -58,6 +74,6 @@ jobs:
5874
git config --global user.email "releases@lvivjavaclub.github.io"
5975
git config --global user.name "GitHub actions"
6076
git add ${{ env.FILENAME }}
61-
git commit -m 'Create ${{ github.event.inputs.post_title }}'
77+
git commit -m 'Create Event#${{ env.next_event }} ${{ github.event.inputs.post_title }}'
6278
git push
6379

‎.github/workflows/build_test.yml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
inputs:
77
post_title:
88
description: 'Used for filename and post.sh name. The space will be replaced by `-` inv the file name.'
9-
default: 'Something'
9+
default: 'Something Cool'
1010
required: true
1111
post_body:
1212
description: 'Use GitHub MD format'
@@ -52,10 +52,25 @@ jobs:
5252
echo "next_event=$nextEvent" >> $GITHUB_ENV
5353
echo "FILENAME=${{ env.FILENAME_PREFIX }}${filename}" >> $GITHUB_ENV
5454
55+
- name: Create post
56+
run: |
57+
echo 'POST<<EOF' >> $GITHUB_ENV
58+
echo '---' >> $GITHUB_ENV
59+
echo 'layout: post' >> $GITHUB_ENV
60+
echo 'title: \"${{ github.event.inputs.post_title }}\"' >> $GITHUB_ENV
61+
echo 'image: /images/default.jpg' >> $GITHUB_ENV
62+
echo 'tags: [${{ github.event.inputs.tags }}]' >> $GITHUB_ENV
63+
echo 'date: $(date +'%Y-%m-%d %H:%M:%S %z')' >> $GITHUB_ENV
64+
echo 'video: ' >> $GITHUB_ENV
65+
echo '---' >> $GITHUB_ENV
66+
echo '' >> $GITHUB_ENV
67+
echo '${{ github.event.inputs.post_body }}' >> $GITHUB_ENV
68+
echo 'EOF' >> $GITHUB_ENV
5569
5670
- name: Create post file
5771
run: |
5872
echo "${{ env.next_event }}"
5973
echo "${{ env.FILENAME }}"
74+
echo "${{ env.POST }}"
6075
6176

0 commit comments

Comments
 (0)