-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (99 loc) · 3.21 KB
/
validate-structure.yml
File metadata and controls
116 lines (99 loc) · 3.21 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
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
116
name: Run JavaScript Script
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
workflow_dispatch:
jobs:
run-script:
runs-on: windows-latest
env:
SCRIPT_DIR: ./eng/scripts/ValidateYaml
TEMP_PATH: ./temp-output.txt
# strategy:
# matrix:
# file: ["file1.txt", "file2.txt"]
steps:
# - name: Install PowerShell
# run: |
# sudo apt-get update
# sudo apt-get install -y wget apt-transport-https software-properties-common
# wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
# sudo dpkg -i packages-microsoft-prod.deb
# sudo apt-get update
# sudo apt-get install -y powershell
# - name: Set directory path variable
# id: set_vars
# run: |
# echo "SCRIPT_DIR=./eng/scripts/ValidateYaml" >> $GITHUB_ENV
# echo "TEMP_PATH=temp-output.txt" >> $GITHUB_ENV
- name: Run PowerShell script
run: |
Write-Output "Running PowerShell!"
$PSVersionTable
shell: pwsh
- name: Checkout Repository
uses: actions/checkout@v3
- name: Write to a temporary file with PowerShell
shell: pwsh
run: |
# $tempPath = "temp-output.txt"
# "Hello from a file!" | Out-File -FilePath $env:tempPath -Encoding utf8
# $tempPath = "temp-output.txt"
./eng/scripts/test-output.ps1 -tempPath $env:TEMP_PATH
- name: Read from the temporary file with PowerShell
shell: pwsh
run: |
# $tempPath = "temp-output.txt"
$content = Get-Content -Path $env:TEMP_PATH
Write-Output "Content from file: $content"
- name: 在读取之前检查文件是否存在1111
run: |
ls -l temp-output.txt
- name: Set Up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: 在读取之前检查文件是否存在222
run: |
ls -l temp-output.txt
- name: 打印当前路径111
run: |
echo "当前路径: $(pwd)"
- name: Install Dependencies
shell: bash
run: |
if [ -f $SCRIPT_DIR/package.json ]; then
echo "Found package.json in $SCRIPT_DIR. Running npm install..."
cd $SCRIPT_DIR
npm install
else
echo "package.json not found in $SCRIPT_DIR. Skipping npm install."
fi
- name: 打印当前路径222
run: |
echo "当前路径: $(pwd)"
- name: 在读取之前检查文件是否存在333
run: |
ls -l temp-output.txt
- name: 打印当前路径333
run: |
echo "当前路径: $(pwd)"
- name: Run Script
shell: bash
run: |
echo "$TEMP_PATH"
if [ -f $SCRIPT_DIR/validateYaml.js ]; then
node ./$SCRIPT_DIR/validateYaml.js $TEMP_PATH
else
echo "validateYaml.js not found in $SCRIPT_DIR. Exiting."
exit 1
fi
working-directory: ./
- name: 打印当前路径444
run: |
echo "当前路径: $(pwd)"