Skip to content

Commit

Permalink
Action to insert new zsm
Browse files Browse the repository at this point in the history
  • Loading branch information
llauner committed Mar 26, 2024
1 parent a90e24f commit 0c337e9
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/zsm-generate-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,10 @@ jobs:
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H:%m:%S')"

# - name: Create and checkout new branch
# run: |
# current_date=${{ steps.date.outputs.date }}

# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global user.name "github-actions[bot]"
# git checkout -b autogenerated/zsm-$current_date
# git push origin -u autogenerated/zsm-$current_date

- 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
Expand All @@ -42,17 +37,17 @@ jobs:
cd kml2OpenAir
npm install
echo "## Downloading and converting kmlfile ...: ${{ github.event.inputs.ZSM_URL }}"
node ./main.js ${{ github.event.inputs.ZSM_URL }} ../airspace/zsm_openair.txt
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
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
Expand All @@ -63,7 +58,7 @@ jobs:
commit_message: "Add ZSM file for ${{ steps.date.outputs.date }}"
branch: autogenerated/zsm-${{ steps.date.outputs.date }}
create_branch: true
file_pattern: 'zsm_openair.txt'
file_pattern: ${{ steps.output_filename.outputs.filename }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
Expand Down

0 comments on commit 0c337e9

Please sign in to comment.