Skip to content

Commit

Permalink
FEATURE: Automatically update FC IDs using a periodic CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Feb 1, 2025
1 parent d525bca commit a584b68
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/update_flightcontroller_ids.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Update Flight Controller IDs

on:
workflow_dispatch:
schedule:
- cron: '30 1 * * 3' # Every Wednesday at 1:30 AM

jobs:
update-ids:
runs-on: ubuntu-latest

steps:
- name: Checkout MethodicConfigurator
uses: actions/checkout@v4

- name: Checkout ArduPilot
uses: actions/checkout@v4
with:
repository: ArduPilot/ardupilot
path: ../ardupilot

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Update flight controller IDs
run: python update_flight_controller_ids.py

- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add ardupilot_methodic_configurator/middleware_fc_ids.py
if [ -n "$(git status --porcelain)" ]; then
CHANGED_LINES=$(git diff --staged | grep -E "^[\+\-]" | wc -l)
if [ $CHANGED_LINES -gt 3 ]; then
git commit -m "CHORE: Updated flight controller IDs [skip ci]"
git push
else
echo "Not enough changes to commit (only $CHANGED_LINES lines changed)"
fi
else
echo "No changes to commit"
fi

0 comments on commit a584b68

Please sign in to comment.