-
-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (58 loc) · 1.99 KB
/
scrape.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
name: Scrape
on:
workflow_call:
inputs:
dbc:
required: true
type: string
files:
required: true
type: string
flavor:
required: true
type: string
jobs:
scrape:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v4
- name: Clone DBC archive
uses: actions/checkout@v4
with:
repository: Vladinator/wow-dbc-archive
ref: release/${{ inputs.dbc }}
path: dbc
fetch-depth: 1
id: checkout
- name: Store build version
run: echo "dbc_build=$(git -C dbc log -1 --pretty=%B | grep -Eow '[0-9.]+')" >> "$GITHUB_ENV"
- name: Fetch external ItemSparse
# Vladinator can't seem to get this sorted
run: |
set -e
curl -sfL "https://wago.tools/db2/ItemSparse/csv?build=${{ env.dbc_build }}" -o dbc/itemsparse.csv
if: inputs.flavor == 'classic_era'
- name: Scrape DBC
run: |
set -e
pids=()
while IFS= read -r files; do
script="scripts/$(cut -d: -f1 <<< "$files").py"
output="data/$(cut -d: -f2 <<< "$files" | xargs).lua"
echo "Running '$script' > '$output'"
python3 "$script" > "$output" &
pids+=($!)
done < <(sed '/^$/d' <<< "${{ inputs.files }}")
for pid in "${pids[@]}"; do
wait "$pid" || exit
done
- name: Create pull request
uses: peter-evans/create-pull-request@v7
# requires permissions, see https://github.com/peter-evans/create-pull-request#workflow-permissions
with:
title: Update ${{ inputs.flavor }} data to ${{ env.dbc_build }}
commit-message: Update ${{ inputs.flavor }} data to ${{ env.dbc_build }}
body: 'Full diff: https://github.com/Vladinator/wow-dbc-archive/commit/${{ steps.checkout.outputs.commit }}'
branch: update-data-${{ inputs.flavor }}
delete-branch: true