Determine GitHub Action Runner IP
A simple way to get the IP of the server running your GitHub Actions
I recently had the need to determine the IP address of the server running my GitHib Action. Knowing this may be useful to match-up individual workflow runs with specific entries in log files, or temporarily whitelisting the action runner’s IP during testing.
I found that a cURL request to ipify.org can achieve this simply:
on: workflow_dispatch: push: jobs: ci: runs-on: ubuntu-latest steps: - name: 🛒 Checkout uses: actions/checkout@v2 - name: 🔎 Check IP run: curl https://api.ipify.org
There are published/shared Actions which do something similar (e.g., haythem/public-ip) but whenever possible I avoid these because they are a potential vector for supply chain attacks (a compromised action could access secrets in environment variables).
- The GitHub meta endpoint shows all IP ranges used by GitHub Actions runners and may be useful for whitelisting purposes.