Skip to content

Commit 34e8b38

Browse files
authored
Use GitHub API instead of git to check diff (#374)
1 parent 49a654d commit 34e8b38

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

.github/workflows/comment-on-asciidoc-changes.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout the repository
16-
uses: actions/checkout@v4
17-
with:
18-
# This is considered a security risk when used in conjunction with pull_request_target
19-
# However, we are not running any code from the PR, so it's safe
20-
# https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
21-
ref: ${{ github.event.pull_request.head.sha }}
22-
# This is needed when the action is run in a fork PR
23-
# according to https://github.com/tj-actions/changed-files/blob/065e671731666959f9ea1bbbb7ddb8363a8ae9cd/src/commitSha.ts#L612-L621
24-
repository: ${{ github.event.pull_request.head.repo.full_name }}
25-
15+
# Without a checkout action, the tj-actions/changes-files action
16+
# will use the GitHub API to to determine the diff.
17+
# This way we can avoid checking ot the forked PR and
18+
# minimize the risk of using `pull_request_target` together
19+
# with `actions/checkout`.
20+
# Refs:
21+
# - https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
22+
# - https://github.com/tj-actions/changed-files?tab=readme-ov-file#using-githubs-api-octocat
2623
- name: Get changed files
2724
id: check-files
2825
uses: tj-actions/changed-files@d6e91a2266cdb9d62096cebf1e8546899c6aa18f # v45.0.6

0 commit comments

Comments
 (0)