Skip to content

Commit f2448ba

Browse files
committed
attempt to checkout the PR's branch
This commit adds some debugging (to print the full JSON github context vars) and attempts to checkout the head ref before attempting to do a diff. Hopefully this will fix issues of "object not found" because the diff is currently being done in the repo's default branch (main or master), but that won't work if the PR is being submitted to a different branch (eg 'dev') or, maybe, if the PR is being submitted from a different branch. See also * https://stackoverflow.com/questions/70104600/complete-list-of-github-actions-contexts * #4 * BusKill/buskill-app#90 (comment)
1 parent a15799a commit f2448ba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/unicode_warn.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
################################################################################
22
# File: .github/workflows/unicode_warn.yml
3-
# Version: 0.3
3+
# Version: 0.4
44
# Purpose: Detects Unicode in PRs and comments the results of findings in PR
55
# Authors: Michael Altfield <michael@michaelaltfield.net>
66
# Created: 2021-11-20
@@ -26,6 +26,11 @@ jobs:
2626
pull-requests: write
2727

2828
steps:
29+
30+
- name: Dump GitHub context
31+
env:
32+
GITHUB_CONTEXT: ${{ toJSON(github) }}
33+
run: echo "$GITHUB_CONTEXT"
2934

3035
- name: Prereqs
3136
env:
@@ -45,6 +50,9 @@ jobs:
4550
git config --global --add safe.directory "$(pwd)"
4651
git branch -a
4752
git log
53+
git checkout ${{ github.event.pull_request.head.ref }}
54+
git branch -a
55+
git log
4856
4957
diff=`git diff --unified=0 ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -E "^[+]" | grep -Ev '^(--- a/|\+\+\+ b/)'`
5058
if [ $? -ne 0 ]; then

0 commit comments

Comments
 (0)