51 lines (46 loc) · 1.28 KB
/
create-comment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Create comment
on:
workflow_dispatch:
inputs:
author_name:
type: string
required: true
description: 'Author name'
body:
required: true
type: string
description: 'Comment body'
pathname:
required: true
type: string
description: 'Path of the page commenting on'
jobs:
create_comment:
runs-on: ubuntu-latest
name: Create comment
steps:
- uses: actions/checkout@v3
with:
ref: master
- name: Create comment
run: |
export TIMESTAMP="$(date '+%s')"
export FILENAME="./src/lib/comments/${TIMESTAMP}.md"
mkdir -p "$(dirname $FILENAME)"
cat << EOF > "${FILENAME}"
---
pathname: "${{ inputs.pathname }}"
author-name: "${{ inputs.author_name }}"
timestamp: "${TIMESTAMP}"
---
${{ inputs.body}}
EOF
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: 'comments: new comment from ${{ inputs.author_name }}'
title: 'New comment from ${{ inputs.author_name }}'
body: ''
reviewers: 'ngalaiko'
delete-branch: true
branch-suffix: 'timestamp'