-
-
Notifications
You must be signed in to change notification settings - Fork 7
95 lines (77 loc) · 2.83 KB
/
ci-zenn.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: CI for Zenn
on:
pull_request:
permissions:
contents: read
pull-requests: write
env:
# deno が package.json にあるパッケージを deno.lock で管理しようとするのを防ぐ
# ref: https://github.com/denoland/deno/issues/17916
DENO_NO_PACKAGE_JSON: 1
jobs:
validate-zenn-metadata:
name: Validate metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # Because if `fetch-depth >= 2` is not set, unchanged files will be updated.
- uses: korosuke613/zenn-metadata-updater-action@v3
with:
validate-only: true
check-duplicate-emoji:
name: Check duplicate emoji
runs-on: ubuntu-latest
steps:
# actions-permissions/monitor is disabled,
# because due to certificate errors.
# https://zenn.dev/link/comments/876fc6120021a7
# - uses: GitHubSecurityLab/actions-permissions/monitor@v1
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Fetch main branch
run: |
git fetch origin main:main
- uses: ./.github/actions/setup-deno
- run: |
deno run --allow-read --allow-run=git,grep ./tools/checkDuplicateEmoji.ts
textlint:
name: Check textlint
runs-on: ubuntu-latest
env:
ARTICLES_PATH: articles
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # Because if `fetch-depth >= 2` is not set, unchanged files will be updated.
- uses: tj-actions/changed-files@c65cd883420fd2eb864698a825fc4162dd94482c # v44.5.7
id: changed-files-yaml
with:
files_yaml: |
md:
- '${{ env.ARTICLES_PATH }}/**/*.md'
- name: Changed files
if: steps.changed-files-yaml.outputs.md_any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed-files-yaml.outputs.md_all_changed_files }}
run: |
echo ${{ env.CHANGED_FILES }}
- uses: actions/setup-node@v4
if: steps.changed-files-yaml.outputs.md_any_changed == 'true'
with:
node-version-file: .tool-versions
cache: 'npm'
- name: Install latest corepack
if: steps.changed-files-yaml.outputs.md_any_changed == 'true'
run: |
npm i -g corepack@latest
- if: steps.changed-files-yaml.outputs.md_any_changed == 'true'
run: corepack enable npm
- if: steps.changed-files-yaml.outputs.md_any_changed == 'true'
run: npm ci
- if: steps.changed-files-yaml.outputs.md_any_changed == 'true'
uses: tsuyoshicho/action-textlint@f59453ea4a0f3785c6d75823cdfc086f6c5a650c # v3.9.3
with:
github_token: ${{ secrets.github_token }}
textlint_flags: ${{ steps.changed-files-yaml.outputs.md_all_changed_files }}