generated from actions/typescript-action
-
-
Notifications
You must be signed in to change notification settings - Fork 13
53 lines (46 loc) · 1.47 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
name: 'build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'
permissions:
contents: read
jobs:
build: # make sure build/ci works properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: |
npm ci
npm run all
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./
id: store-json
with:
json: '{"foo": "test"}'
filename: 'test.json'
# todo: add test that checks with additional quotes in the value
- shell: pwsh
name: test the file content
run: |
$content = Get-Content -Path 'test.json'
Write-Host "Found this content in the file:"
Write-Host $content
$test = $content | ConvertFrom-Json
if ($test.foo -eq 'test') {
Write-Host "File found correct"
}
else {
Write-Host "Found this json:"
Write-Host $test | ConvertTo-Json
}