Skip to content

Commit

Permalink
ci: set-environment reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zachstence committed Nov 4, 2024
1 parent e187efa commit b34454b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/set-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on:
workflow_call:

jobs:
set-environment:
env:
ENVIRONMENT: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository && 'pr-from-fork' || 'none' }}
environment: ${{ env.ENVIRONMENT }}
runs-on: ubuntu-latest
steps:
- run: echo "Environment set as '${{ env.ENVIRONMENT }}'"
9 changes: 9 additions & 0 deletions .github/workflows/test-set-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'Test set-environment'

jobs:
test-set-environment:
uses: ./.github/workflows/set-environment.yml
some-job:
runs-on: ubuntu-latest
steps:
- run: echo "blah"
9 changes: 9 additions & 0 deletions act-event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"pull_request": {
"head": {
"repo": {
"full_name": "zachstence/evidence"
}
}
}
}

0 comments on commit b34454b

Please sign in to comment.