File tree Expand file tree Collapse file tree 3 files changed +46
-1
lines changed
Expand file tree Collapse file tree 3 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ title :
3+ layout : post
4+ comments : false
5+ tags :
6+ ---
7+
8+ <!--
9+ The repo generates a post with this template. The file's name will be the PR's title along with its date.
10+ Whatever you write here will be the post.
11+ -->
Original file line number Diff line number Diff line change 1+ name : Create Post from PR
2+
3+ on :
4+ pull_request :
5+ types : [labeled, closed]
6+
7+ jobs :
8+ create_post :
9+ if : ${{ (github.event.pull_request.merged == true && github.event.label.name == 'post') }}
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4
15+
16+ - name : Create post file
17+ id : create_post
18+ run : |
19+ PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
20+ DATE=$(date +'%Y-%m-%d')
21+ PR_TITLE="${DATE}-${PR_TITLE}"
22+ PR_BODY=${{ github.event.pull_request.body }}
23+ POST_FILE="posts/${PR_TITLE}.md"
24+ echo "${PR_BODY}" >> $POST_FILE
25+
26+ - name : Commit and push changes
27+ run : |
28+ git config --global user.name 'github-actions[bot]'
29+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
30+ git add posts/
31+ git commit -m "Create post: ${{ github.event.pull_request.title }}"
32+ git push origin main
Original file line number Diff line number Diff line change 1919
2020 - id : stack
2121 uses : freckle/stack-action@v5
22-
22+ with :
23+ stack-build-arguments : --fast # No pedantic for now
24+
2325 - run : stack exec site build
2426
2527 - run : |
You can’t perform that action at this time.
0 commit comments