-
Notifications
You must be signed in to change notification settings - Fork 25
38 lines (33 loc) · 1.23 KB
/
wikiupdate.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
---
name: Wikiupdate
on: # yamllint disable-line rule:truthy
push:
branches:
- main
jobs:
update_wiki:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: sudo apt install python3
- name: Install dependencies
run: pip3 install -r requirements.txt --upgrade pip
- name: Determine changed locations
run: |
CHANGED_LOCATIONS=$(git diff ${{ github.event.before }}..${{ github.event.after }} --diff-filter=d --name-only | grep 'locations/' | sed 's/locations\/\(.*\)\.yml/location_\1/' | sed -z 's/-/_/g;s/\n/,/g;s/,$//')
echo "Updating for changed locations: $CHANGED_LOCATIONS"
echo "CHANGED_LOCATIONS=$CHANGED_LOCATIONS" >> "$GITHUB_ENV"
- name: Update wiki.freifunk.net
env:
FF_WIKI_USER: ${{ vars.FF_WIKI_USER }}
FF_WIKI_PASSWORD: ${{ secrets.FF_WIKI_PASSWORD }}
run: |
if [ -n "${CHANGED_LOCATIONS}" ]; then
ansible-playbook play.yml --tags wiki --limit "$CHANGED_LOCATIONS" ||true
else
echo "No locations were changed. Skipping update"
fi