Generate updated ZSM branch #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Compute variables | |
id: variables | |
run: | | |
echo "::set-output name=date::$(date +'%Y-%m-%d-%H:%m:%S')" | |
echo "::set-output name=filename::$(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 "## 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 _zsm_openair.txt + france.txt to repo | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
repository: ./airspace | |
commit_message: "Add ZSM file for ${{ steps.variables.outputs.date }}" | |
branch: ${{ steps.variables.outputs.branch_name }} | |
create_branch: true | |
file_pattern: '${{ steps.variables.outputs.filename }} france.txt' | |
# - name: Create Pull Request | |
# uses: peter-evans/create-pull-request@v6 | |
# with: | |
# title: "Add ZSM file for ${{ steps.variables.outputs.date }}" | |
# path: ./airspace | |
# base: main | |
# branch: ${{ steps.variables.outputs.branch_name }} | |
# body: "This PR adds a new ZSM file for the date ${{ steps.variables.outputs.date }}." |