-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (51 loc) · 1.85 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
name: Check Typos in Pull Request
on: [pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
run: |
set -e
git fetch --all
current_commit=${{ github.event.pull_request.head.sha || github.sha }}
changed_files=$(git show --pretty="" --name-only $current_commit || true)
echo "Changed files: $changed_files"
echo "$changed_files" | tr ' ' '\n' > changed_files.txt
echo "CHANGED_FILE_LIST=changed_files.txt" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.14.0-alpha.1'
- name: Install typos
run: |
python3 -m pip install --upgrade pip
pip install typos
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Axios via npm
run: npm install axios
- name: Check typos in changed files and comment on PR
run: |
set -e
TYPO_OUTPUTS=""
while IFS= read -r file; do
typo_outputs=$(typos "$file" --format brief 2>&1) || true
if [[ -n "$typo_outputs" ]]; then
TYPO_OUTPUTS+="$typo_outputs"$'\n'
fi
done < ${{ env.CHANGED_FILE_LIST }}
encoded_typo_outputs=$(echo "$TYPO_OUTPUTS" | base64 -w 0)
echo "encoded_typo_outputs: $encoded_typo_outputs"
echo "ENCODED_TYPO_OUTPUTS=$encoded_typo_outputs" >> $GITHUB_ENV
- name: Run Ruby Action
uses: ./
with:
encoded_typo_outputs: ${{ env.ENCODED_TYPO_OUTPUTS }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pull_request_id: ${{ github.event.pull_request.number }}