Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only_check_changed_filed breaks with PR from fork in v0.0.22 #59

Open
VictoriousRaptor opened this issue Oct 14, 2023 · 2 comments
Open
Milestone

Comments

@VictoriousRaptor
Copy link

VictoriousRaptor commented Oct 14, 2023

When trying to run spell check job it raises an error and just exits. See here.

Config is here

@VictoriousRaptor
Copy link
Author

So basically it fails when PR HEAD is in another repo. I believe it's because we set only_check_changed_filed to true.

 Only checking files changed from dev
##[debug]Skipped logging an issue for the matched line because the severity 'fatal' is not supported.
fatal: ambiguous argument 'refs/private/before': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
git fetch origin  'dev:refs/private/before' 'delay-restart-2:refs/private/after' -- failed:
##[debug]Skipped logging an issue for the matched line because the severity 'fatal' is not supported.
fatal: couldn't find remote ref delay-restart-2
git fetch . 'dev:refs/private/before' 'delay-restart-2:refs/private/after' -- also failed:
##[debug]Skipped logging an issue for the matched line because the severity 'fatal' is not supported.
fatal: couldn't find remote ref delay-restart-2
##[debug]Skipped logging an issue for the matched line because the severity 'fatal' is not supported.
fatal: ambiguous argument 'refs/private/before..refs/private/after': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

The fetch tries to fetch a branch where is not at origin.

if ! git fetch -f origin ${UNSHALLOW:+"$UNSHALLOW"} "$BEFORE":refs/private/before "$AFTER:refs/private/after" > "$git_fetch_log" 2> "$git_fetch_err"; then
echo "git fetch origin ${UNSHALLOW:+"$UNSHALLOW"} '$BEFORE:refs/private/before' '$AFTER:refs/private/after' -- failed:"
cat "$git_fetch_err"
cat "$git_fetch_log"
if ! git fetch -f . "$BEFORE":refs/private/before "$AFTER:refs/private/after" > "$git_fetch_log" 2> "$git_fetch_err"; then
echo "git fetch . '$BEFORE:refs/private/before' '$AFTER:refs/private/after' -- also failed:"
cat "$git_fetch_err"
cat "$git_fetch_log"
fi
fi

@jsoref
Copy link
Member

jsoref commented Dec 5, 2023

I've made some changes:

get_before() {
if [ -z "$BEFORE" ]; then
COMPARE="$(jq -r '.compare // empty' "$GITHUB_EVENT_PATH" 2>/dev/null)"
AFTER="$(jq -r '.pull_request.head.sha // .after // empty' "$GITHUB_EVENT_PATH")"
AFTER="${AFTER:-$GITHUB_SHA}"
if [ -n "$COMPARE" ]; then
BEFORE="$(echo "$COMPARE" | perl -ne 'if (m{/compare/(.*)\.\.\.}) { print $1; } elsif (m{/commit/([0-9a-f]+)$}) { print "$1^"; };')"
BEFORE="$(call_curl \
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/commits/$BEFORE" | jq -r '.sha // empty')"
elif [ -n "$GITHUB_BASE_REF" ]; then
BEFORE="$GITHUB_BASE_REF"
elif [ -n "$AFTER" ] && [ -n "$GITHUB_REF_NAME" ]; then
BEFORE="$(git reflog --no-abbrev --decorate|grep -v "$AFTER" |grep "$GITHUB_REF_NAME" | head -1 | perl -pe 's/\s.*//')"
else
BEFORE="$(git rev-parse "$AFTER"~)"
fi
get_something origin "$BEFORE" before
get_something origin "$AFTER" after

Can you try using @prerelease?

@jsoref jsoref changed the title Fatal error only_check_changed_filed breaks with PR from fork in v0.0.22 Dec 5, 2023
@jsoref jsoref added this to the v0.0.23 milestone Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants