Skip to content

Commit

Permalink
fix: use workflow PR target and checkout params
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen L Arnold <nerdboy@gentoo.org>
  • Loading branch information
sarnold committed Nov 13, 2021
1 parent 91e1a09 commit f59653b
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,21 @@ name: Coverage

on:
workflow_dispatch:
pull_request:
pull_request_target:
types:
- opened
- synchronize
- reopened
push:
branches:
- master

## This workflow needs the `pull-request` permissions to work
## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
pull-requests: write
contents: read

jobs:
pre_ci:
name: Prepare CI environment
Expand All @@ -23,8 +33,8 @@ jobs:
- name: Checkout Project
uses: actions/checkout@v2
with:
# We need to fetch with a depth of 2 for pull_request so we can do HEAD^2
fetch-depth: 2
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Environment
run: |
Expand All @@ -35,7 +45,7 @@ jobs:
env:
COMMIT_PUSH: ${{ github.event.head_commit.message }}
run: |
COMMIT_MESSAGE="${COMMIT_PUSH:-$(git log --format=%B -n 1 HEAD^2)}"
COMMIT_MESSAGE="${COMMIT_PUSH:-$(git log --format=%B -n 1 HEAD)}"
echo "::set-output name=commit_message::${COMMIT_MESSAGE}"
- name: Extract branch name
Expand Down Expand Up @@ -131,7 +141,9 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}


- uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -182,10 +194,6 @@ jobs:
needs: [cov_data, base]

steps:
- uses: actions/checkout@v2
#with:
#fetch-depth: 2

# artifact downloaded to directory: (upload)name/file
- uses: actions/download-artifact@v2

Expand Down

0 comments on commit f59653b

Please sign in to comment.