-
Notifications
You must be signed in to change notification settings - Fork 4
55 lines (49 loc) · 2.01 KB
/
daily.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
name: Run daily TM cron projects
on:
schedule:
- cron: "0 0 * * *" # Run every day at 0 UTC
workflow_dispatch:
inputs:
raw_data_api_url:
description: "Enter Raw data url"
default: "https://api-prod.raw-data.hotosm.org/v1"
required: false
raw_data_api_auth_token:
description: "Raw data api authentication token"
required: false
projectHours:
description: "Number of hours to fetch active projects (1-24)"
required: false
default: "24" # Default value as a string
tasking_manager_api_key:
description: "Enter the TASKING MANAGER API KEY (leave blank if not applicable)"
required: false
jobs:
Run-Scheduled-Exports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Determine project hours
id: project_hours
env:
MANUAL_INPUT: ${{ github.event.inputs.projectHours }}
run: |
if [ "$GITHUB_EVENT_NAME" = "schedule" ] || [ -z "$MANUAL_INPUT" ] || ! [[ "$MANUAL_INPUT" =~ ^[0-9]+$ ]] || [ "$MANUAL_INPUT" -le 0 ] || [ "$MANUAL_INPUT" -gt 24 ]; then
echo "Using default value: 24"
echo "::set-output name=value::24"
else
echo "Using manual input: $MANUAL_INPUT"
echo "::set-output name=value::$MANUAL_INPUT"
fi
- name: Shoot daily projects
run: python tm_extractor.py --fetch-active-projects ${{ steps.project_hours.outputs.value }}
env:
RAW_DATA_API_BASE_URL: ${{ github.event.inputs.raw_data_api_url || 'https://api-prod.raw-data.hotosm.org/v1' }}
RAWDATA_API_AUTH_TOKEN: ${{ github.event.inputs.raw_data_api_auth_token || secrets.RAWDATA_API_AUTH_TOKEN }}
TASKING_MANAGER_API_KEY: ${{ github.event.inputs.tasking_manager_api_key || 'None' }}