-
Notifications
You must be signed in to change notification settings - Fork 4
81 lines (80 loc) · 2.82 KB
/
sync_map.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Sync Map
on:
workflow_dispatch:
inputs:
map_to_sync:
description: ID of the map to sync or `all` to sync all maps
required: true
default: all
pr_title:
description: Title of the PR to create
required: false
repository_dispatch:
types: [sync_map]
schedule:
- cron: '0 5 * * *'
jobs:
sync_map:
permissions:
contents: write
pull-requests: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Set map sync properties
id: set_properties
env:
to_sync: ${{ github.event.inputs.map_to_sync || github.event.client_payload.map_to_sync }}
pr_title: ${{ github.event.inputs.pr_title || github.event.client_payload.pr_title }}
run: |
if [[ "${{ github.event_name }}" == "schedule" ]]; then
to_sync="all"
fi
if [[ -z "${to_sync}" ]]; then
echo "No map ID provided"
exit 1
fi
echo "map_to_sync=${to_sync}" >> $GITHUB_OUTPUT
if [[ ! -z "${pr_title}" ]]; then
echo "pr_title=${pr_title}" >> $GITHUB_OUTPUT
elif [[ "${to_sync}" == "all" ]]; then
echo "pr_title=Update all maps from rowy" >> $GITHUB_OUTPUT
else
echo "pr_title=Update map ${to_sync} from rowy" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.SSH_SELF_DEPLOY_KEY }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
cache-dependency-path: scripts/py/requirements.txt
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
cache-dependency-path: scripts/js/package-lock.json
- name: Install dependencies
run: ./scripts/install.sh
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/187238959541/locations/global/workloadIdentityPools/github-actions/providers/github
service_account: [email protected]
- name: Update from Rowy
run: |
source .envrc
make types
ts-node scripts/js/src/update_from_rowy.ts map_list.yaml ${{ steps.set_properties.outputs.map_to_sync }}
- name: Commit and create or update PR
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update map_list.yaml with new map data
branch: sync-map-${{ steps.set_properties.outputs.map_to_sync }}
title: ${{ steps.set_properties.outputs.pr_title }}
body: Automaticly generated update of map data from Rowy
base: main
delete-branch: true