-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (43 loc) · 1.75 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
60
# 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 in module_data.py
on:
schedule:
- cron: '17 3 * * 0'
workflow_dispatch:
jobs:
check_for_changes:
name: Check if the module_data has changed
runs-on: ubuntu-latest
# Map a step output to a job output
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.py -O education_modules_file.py
wget https://raw.githubusercontent.com/arcus/module_discovery/main/module_data.py -O module_discovery_file.py
changes=$(diff education_modules_file.py module_discovery_file.py | wc -l)
echo "changes=$changes" >> "$GITHUB_OUTPUT"
echo $changes
update_module_data:
name: Update module_data.py
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.py from education_modules
run: |
wget https://raw.githubusercontent.com/arcus/education_modules/metadata_workflow/assets/metadata/module_data.py -O module_data.py
wc module_data.py
- name: Commit
run: |
git status
git config --local user.name actions-user
git config --local user.email "actions@github.com"
git fetch
git add module_data.py
git commit -am "update metadata records"
git push origin main