Skip to content

Commit 094b32c

Browse files
committed
Fix: workaround when apt GPG key is mismatch
- If apt-get update fails, update the GPG key. - Disabling workflow_dispatch event.
1 parent a5318e6 commit 094b32c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
### - branches: [ "main" ]
1010
### schedule:
1111
### - cron: 0 0 * * *
12-
workflow_dispatch:
12+
### workflow_dispatch:
1313

1414
jobs:
1515
build-and-test:
@@ -73,7 +73,16 @@ jobs:
7373
- name: Install additional packages
7474
run: |
7575
# Install dependent packages
76-
sudo apt-get update -qy
76+
sudo apt-get update -qy || {
77+
# It may fail by an outdated GPG key
78+
for F in $(grep -FlR 'http://packages.ros.org/ros2/ubuntu' /etc/apt/sources.list.d/); do
79+
sudo rm -vf "$F"
80+
done
81+
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
82+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \
83+
| sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
84+
sudo apt-get update -y
85+
}
7786
sudo apt-get install -y \
7887
ros-humble-autoware-common-msgs \
7988
libunwind-dev \

.github/workflows/run_unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
# Allows you to run this workflow manually from the Actions tab
1818
# But it can work only if it exists in the default branch
19-
workflow_dispatch:
19+
### workflow_dispatch:
2020

2121
jobs:
2222
run-all-unit-tests:

0 commit comments

Comments
 (0)