-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Automatically update FC IDs using a periodic CI job
- Loading branch information
1 parent
d525bca
commit a584b68
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
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 |