1 name: CI - Upload config.h to API
12 name: Create or Update Target
13 runs-on: ubuntu-latest
16 - uses: actions/checkout@v3
19 uses: tj-actions/changed-files@v34
24 - if: steps.files.outputs.any_changed == 'true'
25 name: Upload configuration
27 API_KEY: ${{secrets.API_KEY}}
28 URL: https://build.betaflight.com/api/config
30 for target_config in ${{ steps.files.outputs.all_changed_files }}; do
32 if [[ $target_config == */config.h ]]; then
33 BOARD_NAME=$(sed -n 's/^.*[[:space:]]BOARD_NAME \([^#]\+\).*$/\1/p' ${target_config} | sed -e 's/[[:space:]]*$//')
34 STATUS_RECEIVED=$(curl -s --write-out "%{http_code}\n" -X POST -H "Content-Type: text/plain; charset=utf-8" -H "API_KEY: ${API_KEY}" --data-binary @${target_config} ${URL} --silent);
35 echo "${BOARD_NAME} --> ${STATUS_RECEIVED}"
37 if [ $STATUS_RECEIVED -ne "200" ]; then
38 echo "Configuration upload not successful (${BOARD_NAME}) for Target configuration ${target_config}."