Skip to content

Commit 9560e24

Browse files
committed
test filename
1 parent d2a89d5 commit 9560e24

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎.github/workflows/build.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525

2626
env:
27+
FILENAME_PREFIX: ./_posts/$(date +'%Y-%m-%d')-$( echo '${{ github.event.inputs.post_title }}' | sed -r 's/[# ]+/-/g' ).md
2728
FILENAME: ./_posts/$(date +'%Y-%m-%d')-$( echo '${{ github.event.inputs.post_title }}' | sed -r 's/[# ]+/-/g' ).md
2829
MESSAGE: ${{ github.event.inputs.post_body }}
2930
POST: |
@@ -41,6 +42,12 @@ jobs:
4142
steps:
4243
- name: Checkout repository
4344
uses: actions/checkout@v2
45+
46+
- name: Calculate event number
47+
run: |
48+
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
4451
4552
- name: Create post file
4653
run: |

‎.github/workflows/build_test.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525

2626
env:
27+
FILENAME_PREFIX: ./_posts/$(date +'%Y-%m-%d')-
2728
FILENAME: ./_posts/$(date +'%Y-%m-%d')-$( echo 'Event#${{ github.event.inputs.post_title }}' | sed -r 's/[# ]+/-/g' ).md
2829
MESSAGE: ${{ github.event.inputs.post_body }}
2930
POST: |
@@ -45,10 +46,14 @@ jobs:
4546
- name: Calculate event number
4647
run: |
4748
lastEvent=$(ls -LR1 | sed -E 's/[0-9]{4}-[0-9]{2}-[0-9]{2}-//;s/Event-//;s/-.*//;s/.md//' | sort -n | tail -1)
48-
echo "next_event=$((lastEvent+1))" >> $GITHUB_ENV
49+
nextEvent=$((lastEvent+1))
50+
echo "next_event=${{ nextEvent }}" >> $GITHUB_ENV
51+
echo "FILENAME=${{ FILENAME_PREFIX }}$( echo 'Event#${{next_event}} ${{ github.event.inputs.post_title }}' | sed -r 's/[# ]+/-/g' ).md" >> $GITHUB_ENV
52+
4953
5054
- name: Create post file
5155
run: |
5256
echo "${{ env.next_event }}"
57+
echo "${{ env.FILENAME }}"
5358
5459

0 commit comments

Comments
 (0)