-
Notifications
You must be signed in to change notification settings - Fork 9
68 lines (56 loc) · 2.48 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
name: Generate ZSM Pull Request
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: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H:%m:%S')"
- name: Compute output filename
id: output_filename
run: echo "::set-output filename=../airspace/${{ steps.date.outputs.date }}_zsm_openair.txt"
- name: Download and convert ZSM file
id: download-convert
run: |
current_date=${{ steps.date.outputs.date }}
echo "## Install openaip-openair-parser"
git clone https://github.com/llauner/kml2OpenAir.git
cd kml2OpenAir
npm install
echo "## Downloading and converting kmlfile ...: ${{ github.event.inputs.ZSM_URL }}"
node ./main.js ${{ github.event.inputs.ZSM_URL }} ${{ steps.output_filename.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.output_filename.outputs.filename }}' france.txt
cd ../airspace
git pull
- name: ⚙️ Push .kml + .kmz to repo
uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./airspace
commit_message: "Add ZSM file for ${{ steps.date.outputs.date }}"
branch: autogenerated/zsm-${{ steps.date.outputs.date }}
create_branch: true
file_pattern: ${{ steps.output_filename.outputs.filename }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "Add ZSM file for ${{ steps.date.outputs.date }}"
branch: "autogenerated/zsm-${{ steps.date.outputs.date }}"
body: "This PR adds a new ZSM file for the date ${{ steps.date.outputs.date }}."