Skip to content

New Data for 2023

New Data for 2023 #76

Workflow file for this run

name: Automated Node-RED flow trigger for imports
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
import-apw:
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 = 'Auskunftsplattform Wasser Land 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/apw
method: 'POST'
customHeaders: '{"Content-Type": "application/json"}'
data: ${{ steps.get-changed-files.outputs.result }}