diff --git a/.github/workflows/fetch_dialect_ardupilotmega.yml b/.github/workflows/fetch_dialect_ardupilotmega.yml new file mode 100644 index 00000000000..4375a05cad5 --- /dev/null +++ b/.github/workflows/fetch_dialect_ardupilotmega.yml @@ -0,0 +1,50 @@ +name: Fetch ardupilotmega dialects from downstream +on: + workflow_dispatch: + +jobs: + copy_and_push: + runs-on: ubuntu-latest + steps: + - name: Checkout this repo + uses: actions/checkout@v4 + with: + repository: mavlink/mavlink + + - name: Download source file(s) + run: | + curl -L https://raw.githubusercontent.com/ArduPilot/mavlink/master/message_definitions/v1.0/ardupilotmega.xml -o ardupilotmega.xml + curl -L https://raw.githubusercontent.com/ArduPilot/mavlink/master/message_definitions/v1.0/loweheiser.xml -o loweheiser.xml + + - name: Check for changes + id: check-changes + run: | + git status --porcelain | grep -q "^??" # Check for untracked files + if [ $? -eq 0 ]; then + echo "No changes detected in the repository. Skipping commit and PR creation." + else + echo "Changes detected. Proceeding with commit and PR creation." + fi + + - name: Copy file (if changes detected) + run: | + mv -f ardupilotmega.xml message_definitions/v1.0/ + mv -f loweheiser.xml message_definitions/v1.0/ + if: steps.check-changes.conclusion == 'success' # Check for success in previous step + + - name: Add and commit changes (if changes detected) + run: | + git config --global user.name "${{ secrets.PX4BUILDBOT_USER }}" + git config --global user.email "${{ secrets.PX4BUILDBOT_EMAIL }}" + git add message_definitions/v1.0/ardupilotmega.xml + git add message_definitions/v1.0/loweheiser.xml + git commit -a -m "ardupilotmega dialects from ArduPilot/mavlink: `date`" + if: steps.check-changes.conclusion == 'success' # Check for success in previous step + + - name: Create Pull Request (if changes detected) + uses: peter-evans/create-pull-request@v7 + with: + title: "[BOT] Add ardupilotmega dialects from ArduPilot/mavlink" + body: "ardupilotmega.xml / loweheiser.xml copied from the ArduPilot/mavlink repository." + target: master + if: steps.check-changes.conclusion == 'success' # Check for success in previous step diff --git a/doc/mavlink_xml_to_markdown.py b/doc/mavlink_xml_to_markdown.py index f78cbd83628..8fce09ba12b 100644 --- a/doc/mavlink_xml_to_markdown.py +++ b/doc/mavlink_xml_to_markdown.py @@ -265,7 +265,7 @@ def getMarkdown(self): def get_top_level_docs(self, filename): # Inject top level heading and other details. # print('FILENAME (prefix): %s' % filename) - insert_text = '\n\n' + insert_text = '\n' if filename == 'common': insert_text += """ # MAVLINK Common Message Set (common.xml) @@ -284,7 +284,9 @@ def get_top_level_docs(self, filename): The message set is defined in [minimal.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/minimal.xml) and is managed by the MAVLink project. -> **Tip** The minimal set is included (imported into) other xml definition files, including the [MAVLink Common Message Set (common.xml)](minimal.md). +::: tip +The minimal set is included (imported into) other xml definition files, including the [MAVLink Common Message Set (common.xml)](minimal.md). +::: """ elif filename == 'standard': @@ -326,12 +328,13 @@ def get_top_level_docs(self, filename): - Systems based on these dialects can co-exist on the same MAVLink network. - A Ground Station might (optionally) use libraries generated from **all.xml** to communicate using any of the dialects. -> **Warning** -> -> - New dialect files in the official repository must be added to **all.xml** and restrict themselves to using ids in their own allocated range. -> - Dialects should push changes to mavlink/mavlink in order to avoid potential clashes from changes to other dialects. -> -> A few older dialects are not included because these operate in completely closed networks or because they are only used for tests. +::: warning + +- New dialect files in the official repository must be added to **all.xml** and restrict themselves to using ids in their own allocated range. +- Dialects should push changes to mavlink/mavlink in order to avoid potential clashes from changes to other dialects. + +A few older dialects are not included because these operate in completely closed networks or because they are only used for tests. +::: This topic is a human-readable form of the XML definition file: [all.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/all.xml). """ @@ -340,21 +343,24 @@ def get_top_level_docs(self, filename): insert_text += """ # Dialect: ArduPilotMega -> **Warning** [ardupilotmega.xml](https://github.com/ArduPilot/mavlink/blob/master/message_definitions/v1.0/ardupilotmega.xml) contains the accurate and up-to-date documentation for this dialect. -> The documentation below may not be accurate if the dialect owner has not pushed changes. +::: warning +[ardupilotmega.xml](https://github.com/ArduPilot/mavlink/blob/master/message_definitions/v1.0/ardupilotmega.xml) contains the documentation for this dialect as used by the ArduPilot flight stack. +The documentation here may not be a precise match if, for example, changes have not been pushed by the owner. +::: -These messages define the [ArduPilot](http://ardupilot.org) specific dialect (as pushed to the [mavlink/mavlink](https://github.com/mavlink/mavlink) GitHub repository by the dialect owner). +These messages define the [ArduPilot](http://ardupilot.org) specific dialect. This topic is a human-readable form of the XML definition file: [ardupilotmega.xml](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/ardupilotmega.xml). - """ elif filename == 'cubepilot': insert_text += """ # Dialect: cubepilot -> **Warning** [cubepilot.xml](https://github.com/CubePilot/mavlink/blob/master/message_definitions/v1.0/cubepilot.xml) contains the accurate and up-to-date documentation for this dialect. -> The documentation below may not be accurate if the dialect owner has not pushed changes. +::: warning +[cubepilot.xml](https://github.com/CubePilot/mavlink/blob/master/message_definitions/v1.0/cubepilot.xml) contains the accurate and up-to-date documentation for this dialect. +The documentation here may not be a precise match if, for example, changes have not been pushed by the owner. +::: These messages define the [CubePilot](http://www.cubepilot.com) specific dialect (as pushed to the [mavlink/mavlink](https://github.com/mavlink/mavlink) GitHub repository by the dialect owner). @@ -369,18 +375,22 @@ def get_top_level_docs(self, filename): insert_text += f""" # Dialect: {dialectName} -> **Warning** This topic documents the version of the dialect file in the [mavlink/mavlink](https://github.com/mavlink/mavlink) Github repository, which may not be up to date with the file in the source repository (it is up to the dialect owner to push changes when needed). -> The source repo should be listed in the comments at the top of the XML definition file listed below (but may not be). +::: warning +This topic documents the version of the dialect file in the [mavlink/mavlink](https://github.com/mavlink/mavlink) Github repository, which may not be up to date with the file in the source repository (it is up to the dialect owner to push changes when needed). +The source repo should be listed in the comments at the top of the XML definition file listed below (but may not be). +::: This topic is a human-readable form of the XML definition file: [{filenameXML}](https://github.com/mavlink/mavlink/blob/master/message_definitions/v1.0/{filenameXML}). """ insert_text += """ - -> **Note** -> - MAVLink 2 [extension fields](../guide/define_xml_element.md#message_extensions) are displayed in blue. -> - Entities from dialects are displayed only as headings (with link to original) +::: info + +- MAVLink 2 [extension fields](../guide/define_xml_element.md#message_extensions) are displayed in blue. +- Entities from dialects are displayed only as headings (with link to original) + +:::