-
Notifications
You must be signed in to change notification settings - Fork 9
72 lines (62 loc) · 2.88 KB
/
zsm-generate-pr.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
61
62
63
64
65
66
67
68
69
70
71
72
name: Generate updated ZSM branch
on:
workflow_dispatch:
inputs:
ZSM_URL:
description: 'URL to the ZSM .kml file'
required: true
default: 'https://www.stac.aviation-civile.gouv.fr/sites/default/files/france_1.kml'
jobs:
Download-Convert-ZSM-File:
name: Download and convert ZSM file
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v4
with:
path: 'airspace'
- name: Compute variables
id: variables
run: |
echo "::set-output name=date::$(date +'%Y-%m-%d-%H:%m:%S')"
echo "::set-output name=filename::autogenerated/$(date +'%Y-%m-%d-%H-%m-%S')_zsm_openair.txt"
echo "::set-output name=branch_name::autogenerated/$(date +'%Y-%m-%d-%H-%m-%S')_zsm_openair"
- name: Download and convert ZSM file
id: download-convert
run: |
echo "## Install openaip-openair-parser"
git clone https://github.com/llauner/kml2OpenAir.git
cd kml2OpenAir
npm install
echo "## Remove old zsm files ..."
rm -f ../airspace/*_zsm_openair.txt
echo "## Downloading and converting kmlfile ...: ${{ github.event.inputs.ZSM_URL }}"
node ./main.js ${{ github.event.inputs.ZSM_URL }} ../airspace/${{ steps.variables.outputs.filename }}
- name: Insert new ZSM
run: |
cd airspace
echo "## Remove old ZSM entries from france.txt ..."
sed -i '/\* ### ZSM start ###/,/\* ### ZSM stop ###/{//!d}' france.txt
echo "## Insert new ZSM entries ..."
sed -i '/\* ### ZSM start ###/r ${{ steps.variables.outputs.filename }}' france.txt
- name: ⚙️ Push .geojson to repo
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Add ZSM file for ${{ steps.variables.outputs.date }}"
repository: ./airspace
file_pattern: '${{ steps.variables.outputs.filename }} autogenerated/*_zsm_openair.txt france.txt'
create_branch: true
branch: ${{ steps.variables.outputs.branch_name }}
# - name: Create Pull Request
# uses: peter-evans/create-pull-request@v6
# with:
# title: "Add ZSM file for ${{ steps.variables.outputs.date }}"
# commit-message: "Add ZSM file for ${{ steps.variables.outputs.date }}"
# path: ./airspace
# add-paths: |
# ${{ steps.variables.outputs.filename }}
# *_zsm_openair.txt
# france.txt
# base: main
# branch: ${{ steps.variables.outputs.branch_name }}
# body: "This PR adds a new ZSM file for the date ${{ steps.variables.outputs.date }}."