Action to Set a Host for Testing?

In Travis, you can configure a host domain with

addons:
    hosts:
        - localhost.example.com

Is there a similar GitHub Action that will handle this behavior?

Or is the best solution the one found at this thread?

sudo echo "127.0.0.1 localhost.example.com" >> /etc/hosts
1 Like

Could you explain what exactly that Travis configuration is expected to do?

If you simply want to add IP/host mappings then yes, writing to /etc/hosts is the best option. Just note that the quoted command won’t work, running echo as root doesn’t change anything, the writing to /etc/hosts needs to happen as root:

echo "127.0.0.1 localhost.example.com" | sudo tee -a /etc/hosts