mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-23 07:00:49 +08:00
Since the runner image rotation on 2026-10-20 every sync has failed to push to PX4/px4_msgs with "could not read Username for 'https://github.com'". The token was never rejected: the image carries libcurl 7.81.0-1ubuntu1.30, whose CVE-2026-94266 fix strips credentials from CURLINFO_EFFECTIVE_URL, and git 2.55 compares that against the URL it requested, reports a redirect that never happened and re-derives its credentials from the stripped URL. A token embedded as the URL username is therefore dropped before the push. Clone px4_msgs without credentials and let gh's credential helper supply the token from GH_TOKEN. This is the interface git and GitHub provide for this, it survives the libcurl change on both the current and the previous image, and it keeps the token out of argv and .git/config on the runner. Reproduced with the runner's exact git 2.55.0 PPA build against the patched jammy libcurl: the URL form fails identically, the credential helper path sends the credentials. Assisted-by: Claude:claude-mythos-5-1 Signed-off-by: Ramon Roche <mrpollo@gmail.com>
81 lines
2.5 KiB
YAML
81 lines
2.5 KiB
YAML
name: Sync ROS 2 messages to px4_msgs
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
- 'stable'
|
|
- 'beta'
|
|
- 'release/**'
|
|
paths:
|
|
- 'msg/**'
|
|
- 'srv/**'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
sync_to_px4_msgs:
|
|
if: github.repository == 'PX4/PX4-Autopilot'
|
|
runs-on: [runs-on,runner=4cpu-linux-x64,image=ubuntu22-full-x64,"run-id=${{ github.run_id }}",spot=false]
|
|
env:
|
|
# read by gh's git credential helper at push time
|
|
GH_TOKEN: ${{ secrets.PX4BUILTBOT_PERSONAL_ACCESS_TOKEN }}
|
|
steps:
|
|
- name: Checkout PX4 repo
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup git credentials
|
|
run: |
|
|
git config --global user.name "${{ secrets.PX4BUILDBOT_USER }}"
|
|
git config --global user.email "${{ secrets.PX4BUILDBOT_EMAIL }}"
|
|
# Hand the token to git through gh's credential helper instead of the clone URL.
|
|
# libcurl with the CVE-2026-94266 fix strips credentials from the effective URL,
|
|
# and git 2.55 mistakes that for a redirect and drops them, so a token embedded
|
|
# in the URL is never sent on push.
|
|
gh auth setup-git
|
|
|
|
- name: Clone PX4_msgs repo
|
|
run: |
|
|
git clone https://github.com/PX4/px4_msgs.git
|
|
|
|
- name: Check out the same branch as the PX4 repo
|
|
run: |
|
|
cd px4_msgs
|
|
if git checkout ${{ github.ref_name }}; then
|
|
echo "Checked out existing branch"
|
|
else
|
|
git checkout -b ${{ github.ref_name }}
|
|
fi
|
|
|
|
- name: Copy ROS 2 messages
|
|
run: |
|
|
rm -f px4_msgs/msg/*.msg
|
|
rm -f px4_msgs/msg/versioned/*.msg
|
|
rm -f px4_msgs/srv/*.srv
|
|
rm -f px4_msgs/srv/versioned/*.srv
|
|
cp msg/*.msg px4_msgs/msg/
|
|
cp msg/versioned/*.msg px4_msgs/msg/ || true
|
|
cp srv/*.srv px4_msgs/srv/
|
|
cp srv/versioned/*.srv px4_msgs/srv/ || true
|
|
|
|
- name: Commit and push changes
|
|
shell: bash
|
|
env:
|
|
# fail on a rejected token instead of prompting for a username
|
|
GIT_TERMINAL_PROMPT: 0
|
|
run: |
|
|
set -euo pipefail
|
|
cd px4_msgs
|
|
git status
|
|
git add .
|
|
if git diff --cached --quiet; then
|
|
echo "No message changes to commit"
|
|
else
|
|
git commit -m "Update to PX4 ${{ github.sha }}"
|
|
fi
|
|
# push even without a new commit, so a bad token or a new branch never goes unnoticed
|
|
git push origin ${{ github.ref_name }}
|
|
cd ..
|
|
rm -rf px4_msgs
|