-
Notifications
You must be signed in to change notification settings - Fork 8
56 lines (54 loc) · 1.65 KB
/
pull.yaml
File metadata and controls
56 lines (54 loc) · 1.65 KB
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
52
53
54
55
56
name: "[Reusable workflows] pull from hatenablog"
on:
workflow_call:
inputs:
BLOG_DOMAIN:
required: true
type: string
runner:
required: false
default: ubuntu-latest
type: string
secrets:
OWNER_API_KEY:
required: true
jobs:
pull:
runs-on: ${{ inputs.runner }}
env:
BLOGSYNC_PASSWORD: ${{ secrets.OWNER_API_KEY }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: setup
uses: hatena/hatenablog-workflows/.github/actions/setup@6c7e0917c0ba2b68ccedc5710fd810805c91fa5f
- name: set blog domain
id: set-domain
run: |
domain=${{ inputs.BLOG_DOMAIN }}
echo "BLOG_DOMAIN=$(echo $domain | tr -d '\n\r ')" >> "$GITHUB_OUTPUT"
- name: pull
run: |
blogsync pull ${{ steps.set-domain.outputs.BLOG_DOMAIN }}
- name: delete draft files
run: |
target=$(git ls-files -mo --exclude-standard | xargs grep -xl 'Draft: true')
if [[ -n "$target" ]]; then
IFS=" " read -r -a draft_files <<< "$(echo "$target" | xargs)"
for file in "${draft_files[@]}"; do
rm "$file"
done
fi
- name: create pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
title: blogsync pull
branch: blogsync-pull
commit-message: |
blogsync pull
body: |
blogsync pull
labels: |
skip-push
delete-branch: true