Skip to content
This repository was archived by the owner on Jan 4, 2024. It is now read-only.

Commit 76bb66d

Browse files
committed
root オプションを追加したローカルの actions/publish を利用する
1 parent 5810079 commit 76bb66d

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- uses: actions/checkout@v3
2424
with:
2525
fetch-depth: 0
26-
- uses: increments/qiita-cli/actions/publish@v1
26+
# NOTE: increments/qiita-cli/actions/publish の代わりにローカルの publish を利用
27+
- uses: ./actions/publish
2728
with:
2829
qiita-token: ${{ secrets.QIITA_TOKEN }}

actions/publish/action.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Publish articles to Qiita"
2+
description: "Publish articles to Qiita using qiita-cli"
3+
author: "Qiita Inc."
4+
5+
inputs:
6+
root:
7+
required: false
8+
default: '.'
9+
description: "Root directory path"
10+
qiita-token:
11+
required: true
12+
description: "Qiita API token"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: "18.16.0"
20+
- name: Install qiita-cli
21+
run: npm install -g @qiita/qiita-cli@v1.0.0
22+
shell: bash
23+
- name: Publish articles
24+
run: qiita publish --all --root ${{ inputs.root }}
25+
env:
26+
QIITA_TOKEN: ${{ inputs.qiita-token }}
27+
shell: bash
28+
- name: Commit and push diff # Not executed recursively even if `push` is triggered. See https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
29+
run: |
30+
git add ${{ inputs.root }}/public/*
31+
if ! git diff --staged --exit-code --quiet; then
32+
git config --global user.name 'github-actions[bot]'
33+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
34+
git commit -m 'Updated by qiita-cli'
35+
git push
36+
fi
37+
shell: bash

0 commit comments

Comments
 (0)