Skip to content

Commit

Permalink
ci: Add environment
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jul 16, 2024
1 parent b61a053 commit 7854d4b
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
name: CI - Pull Request
on:
pull_request:
pull_request_target: #TODO: Keep only this
pull_request_target:
pull_request: #TODO: Remove this

jobs:
set-env:
name: "Set environment"
runs-on: ubuntu-latest
outputs:
env: ${{ steps.get_env.outputs.env }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{github.event.pull_request.head.repo.full_name}}
ref: ${{ github.head_ref }}
- name: Determine Environment
id: get_env
run: |
codeowners=$(cat .github/CODEOWNERS)
if [[ $(echo "${codeowners[@]}" | fgrep -w "@${{github.actor}}") ]]; then
echo PROWNER
echo "env=pr_owner" >> $GITHUB_OUTPUT
else
echo PR
echo "env=pr" >> $GITHUB_OUTPUT
fi
code-quality:
name: Code quality
runs-on: ubuntu-latest
timeout-minutes: 20
needs: set-env
environment: ${{needs.set-env.outputs.env}}
steps:
- uses: actions/checkout@v4
with:
Expand Down

0 comments on commit 7854d4b

Please sign in to comment.