generated from actions/typescript-action
-
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (98 loc) · 3.2 KB
/
test.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: "CI"
on: # rebuild any PRs and main branch changes
pull_request:
branches:
- main
jobs:
build-package: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run package
test-lint: # make sure build/ci work properly
permissions:
contents: read
checks: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run ci
- name: Upload test report
if: ${{ always() }}
uses: mikepenz/action-junit-report@ac30be7acb0a361e5492575ab42e47fcadec4928 # v4.2.2
with:
report_paths: "**/reports/jest.xml"
github_token: ${{ secrets.GITHUB_TOKEN }}
use-with-dry-run: # make sure the action works on a clean machine without building
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: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run package
- run: "git log -m -1 --name-only --pretty=format: HEAD"
- run: "git log -m -1 --name-only HEAD"
- run: |
cp articles/sampleMarkdown.md articles/test.md
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add -A
git commit -m "test"
- uses: ./
env:
TZ: Asia/Tokyo
with:
published: true
auto-generate-published-at: next_business_day_10
dry-run: true
validate: true
commit-sha: .
- run: git diff articles/test.md
use-with-validate-only:
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: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- run: npm ci
- run: npm run package
- run: "git log -m -1 --name-only --pretty=format: HEAD"
- run: "git log -m -1 --name-only HEAD"
- run: |
cp ./src/__tests__/invalidMarkdown.md .
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add -A
git commit -m "test"
- name: "Execute validate-only. This step must fail. Print 'Error: Invalid metadata: emoji'."
uses: ./
id: action
with:
validate-only: true
commit-sha: .
continue-on-error: true
- if: ${{ steps.action.outcome == 'failure' }}
run: echo "Success"
- if: ${{ steps.action.outcome == 'success' }}
run: |
echo "Failure"
exit 1