diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index a7be9e0..77195ae 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -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: