This is a 3rd-party problem. Ubuntu maintainers have called off the latest libc release for Focal, 2.31-0ubuntu9.3, which Travis builders have preinstalled.
So the packages you’re trying to install (in partucular, valgrind dependency libc6-dbg) now require an earlier version while the preinstalled libc6-dev requires the new one. Apt can’t resolve this situation automatically.
In your Github Action, you’re installing a different set of packages, from a different source – in particular, you’re not installing valgrind.
Comment out the addons: apt: section and add the following commands. The first one downgrades libc6 and libc6-dev, the 2nd one manually installs the packages that you were installing in your addons: apt: clause.
Now, once you use dist: focal and language: cpp within your build will be using the default version that should be ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31. I have also tested this [1] and it gets the version correctly.