File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -47,19 +47,21 @@ jobs:
47
47
echo "::set-output name=path::${{ runner.temp }}"
48
48
echo "::set-output name=filename::diff.txt"
49
49
50
- - name : Checkout local repository
51
- uses : actions/checkout@v2
52
-
53
- - name : Checkout PR branch
54
- run : |
55
- # https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally
56
- # It's necessary to reference both pull_request.number and issue.number because only one of the two are defined depending on whether the workflow is triggered by PR or comment event.
57
- git fetch origin pull/${{ github.event.pull_request.number }}${{ github.event.issue.number }}/head:pr-branch
58
- git checkout pr-branch
50
+ - name : Get PR diff
51
+ id : get-diff
52
+ uses : octokit/request-action@v2.x
53
+ env :
54
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55
+ with :
56
+ mediaType : |
57
+ format: diff
58
+ route : GET /repos/{owner}/{repo}/pulls/{pull_number}
59
+ owner : ${{ github.repository_owner }}
60
+ repo : ${{ github.event.repository.name }}
61
+ pull_number : ${{ github.event.pull_request.number }}${{ github.event.issue.number }}
59
62
60
- - name : Generate diff file
61
- run : |
62
- git diff --unified=0 --ignore-blank-lines --ignore-space-at-eol --output="${{ steps.configuration.outputs.path }}/${{ steps.configuration.outputs.filename }}" ${{ github.sha }}
63
+ - name : Write diff to file
64
+ run : printf -- '%b' ${{ steps.get-diff.outputs.data }} > "${{ steps.configuration.outputs.path }}/${{ steps.configuration.outputs.filename }}"
63
65
64
66
- name : Upload diff file to workflow artifact
65
67
uses : actions/upload-artifact@v2
You can’t perform that action at this time.
0 commit comments