-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (42 loc) · 1.79 KB
/
update_module_data.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
# This workflow updates the data in module_data.py once a week.
# It can also be run manually if significant changes to metadata have been made.
name: Update metadata from education_modules repository
on:
schedule:
- cron: '17 3 * * 0'
workflow_dispatch:
jobs:
check_for_changes:
name: Check if the module_data has changed
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.check_if_changed.outputs.changes }}
steps:
- name: Compare module_data files
id: check_if_changed
run: |
wget https://raw.githubusercontent.com/arcus/education_modules/metadata_workflow/assets/metadata/module_data.json -O education_modules_file.json
wget https://raw.githubusercontent.com/arcus/module_discovery/main/assets/education_modules.json -O module_discovery_file.json
changes=$(diff education_modules_file.json module_discovery_file.json | wc -l)
echo "changes=$changes" >> "$GITHUB_OUTPUT"
echo $changes
update_module_data:
name: Update module_data.json
runs-on: ubuntu-latest
needs: check_for_changes
if: needs.check_for_changes.outputs.changes != 0
steps:
- uses: actions/checkout@v3
- name: Download module_data.json from education_modules
run: |
wget https://raw.githubusercontent.com/arcus/education_modules/metadata_workflow/assets/metadata/module_data.json -O assets/education_modules.json
wc assets/education_modules.json
- name: Commit
run: |
git status
git config --local user.name actions-user
git config --local user.email "actions@github.com"
git fetch
git add assets/education_modules.json
git commit -am "update metadata records"
git push origin main