Skip to content

Commit

Permalink
add action
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Apr 25, 2024
1 parent 1cf0b2f commit 9d1125e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
16 changes: 16 additions & 0 deletions .github/actions/no-production-domains/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Block requests to production domains
description: Adds configuration to /etc/hosts to stop tests accidentally reaching production
runs:
using: "composite"
steps:
- shell: bash
run: |
if [ "$NOT_LINUX" == "true" ] ; then
echo "Can't set /etc/hosts configuration on non-Linux runner"
exit 1
fi
echo "203.0.113.0 logfire.dev" | sudo tee -a /etc/hosts
echo "203.0.113.0 logfire-api.pydantic.dev" | sudo tee -a /etc/hosts
echo "203.0.113.0 logfire.pydantic.dev" | sudo tee -a /etc/hosts
env:
NOT_LINUX: runner.os != 'linux'
12 changes: 1 addition & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Ensure requests to production domains fail
shell: bash
run: |
if [ "$NOT_LINUX" == "true" ] ; then
echo "Can't set /etc/hosts configuration on non-Linux runner"
exit 1
fi
echo "203.0.113.0 logfire.dev" | sudo tee -a /etc/hosts
echo "203.0.113.0 logfire-api.pydantic.dev" | sudo tee -a /etc/hosts
echo "203.0.113.0 logfire.pydantic.dev" | sudo tee -a /etc/hosts
env:
NOT_LINUX: ${{ matrix.os }} != 'linux'
uses: ./.github/actions/no-production-domains
- name: set up python
uses: actions/setup-python@v5
with:
Expand Down

0 comments on commit 9d1125e

Please sign in to comment.