-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathupdate_flightcontroller_ids.yml
More file actions
89 lines (75 loc) · 3 KB
/
update_flightcontroller_ids.yml
File metadata and controls
89 lines (75 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Update Flight Controller IDs
on:
workflow_dispatch:
schedule:
- cron: '30 3 * * 1,4' # Every Monday and Thursday at 3:30 AM
permissions:
contents: read
jobs:
update-ids:
permissions:
contents: write # for Git to git push
pull-requests: write # for creating PRs
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout MethodicConfigurator
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Checkout ArduPilot
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: ArduPilot/ardupilot
path: ardupilot
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.x'
- name: Install dependencies
id: install_deps
continue-on-error: true
run: |
WARNINGS=0
export PIP_VERSION=$(grep -oP 'pip\s*==\s*\K[0-9]+(\.[0-9]+)*' pyproject.toml || echo '')
if [ -z "$PIP_VERSION" ]; then
echo "::warning::Could not detect pip version in pyproject.toml; falling back to latest."
PIP_INSTALL="pip"
WARNINGS=1
else
echo "Will install pip version $PIP_VERSION."
PIP_INSTALL="pip==$PIP_VERSION"
fi
python -m pip install "$PIP_INSTALL"
mv ardupilot ..
echo "warnings=$WARNINGS" >> $GITHUB_OUTPUT
if [ "$WARNINGS" -eq 1 ]; then
exit 1
fi
- name: Update flight controller IDs
run: python update_flight_controller_ids.py
- name: Stage changes
id: stage_changes
run: |
git add ardupilot_methodic_configurator/data_model_fc_ids.py
CHANGED_LINES=$(git diff --staged | grep -E "^[\+\-]" | wc -l)
echo "CHANGED_LINES=$CHANGED_LINES" >> $GITHUB_OUTPUT
if [ $CHANGED_LINES -gt 3 ]; then
echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT
else
echo "Not enough changes to commit (only $CHANGED_LINES lines changed)"
echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: steps.stage_changes.outputs.HAS_CHANGES == 'true'
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: flightcontroller-IDs, automated-pr
branch: update/flight-controller-ids
title: "Update ArduPilot flight controller IDs"
commit-message: "chore(flightcontroller): Updated ArduPilot flight controller IDs"
body: |
This PR updates the ArduPilot flight controller IDs from the upstream ArduPilot repository.
delete-branch: true