Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (38 sloc) 1.39 KB
name: publish-comments
on:
issue_comment:
types: [created, edited]
jobs:
add_comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- name: Turn comment into file
run: |
ID=${{ github.event.comment.id }}
AUTHOR=${{ github.event.comment.user.login }}
DATE=${{ github.event.comment.created_at }}
COMMENT=$(echo "${{ github.event.comment.body }}")
NO_TAGS=${COMMENT//[<>]/\`}
FOLDER=src/comments
printf '%b\n' "\r\n<div class=\"comment\"><p>${AUTHOR} says:</p><p>${NO_TAGS//$'\n'/\<\/p\>\<p\>}</p><p>${DATE}</p></div>\r\n" > ${FOLDER}/${ID}.html
- name: Assemble page
run: |
cat src/header.html > index.html
find src/comments/ -name "*.html" | sort -r | xargs -I % cat % >> index.html
cat src/footer.html >> index.html
- name: Push changes to repo
env:
TOKEN: ${{ secrets.PAGES_TOKEN }}
run: |
REMOTE=https://${{ secrets.TOKEN }}@github.com/${{ github.repository }}
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config user.name "${{ github.actor }}"
git pull ${REMOTE}
git checkout master
git add .
git status
git commit -am "Add new comment"
git push ${REMOTE} master
You can’t perform that action at this time.