New Data for 2023 #49
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: Automated Node-RED flow trigger for imports | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
import-lgb: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Get list of changed files | |
uses: actions/github-script@v4 | |
id: get-changed-files | |
with: | |
script: | | |
const compareCommits = await github.repos.compareCommits({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
base: context.payload.before, | |
head: context.payload.after | |
}); | |
const folder = 'Landesvermessung und Geobasisinformation Brandenburg/'; | |
const files = compareCommits.data.files.filter( | |
file => file.filename.startsWith(folder) && !file.filename.endsWith('README.md') | |
); | |
if (files.length) { | |
return { filenames: files.map(file => file.filename.split('/').pop().split('.csv')[0]) }; | |
} | |
- name: Trigger HTTP request | |
uses: fjogeleit/http-request-action@v1 | |
if: steps.get-changed-files.outputs.result != '' | |
with: | |
url: ${{ secrets.NODE_RED_URL }}/api/v1/import/lgb | |
method: 'POST' | |
customHeaders: '{"Content-Type": "application/json"}' | |
data: ${{ steps.get-changed-files.outputs.result }} |