Skip to content

Commit 1b4863d

Browse files
authored
fix CI on PRs from forks (#1042)
Signed-off-by: Itai Segall <itai.segall@digitalasset.com>
1 parent fbaccb3 commit 1b4863d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/actions/scripts/common_setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ git checkout main
1717
echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF:-}"
1818
if [ -n "${GITHUB_HEAD_REF:-}" ] && [ "$GITHUB_HEAD_REF" != "main" ]; then
1919
echo "Checking out $GITHUB_HEAD_REF"
20-
git checkout "$GITHUB_HEAD_REF"
20+
# On PRs from forks, GITHUB_HEAD_REF is the name of the branch in the forked repo, so we cannot actually checkout that branch directly.
21+
git checkout "$GITHUB_HEAD_REF" || true
2122
fi
2223
git fetch origin 'refs/heads/release-line*:refs/heads/origin/release-line*' --force
2324

scripts/todo/src/checkTodos.sc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ val fixedIssuesCurrentPR: Set[Int] = {
7777
prNumO.fold(Set.empty[Int])({ prNum =>
7878
val prInfo = Seq("hub", "pr", "show", "-f", "%b", prNum).!!
7979
val branch = Seq("hub", "pr", "show", "-f", "%H", prNum).!!.trim
80-
val commits = Seq("git", "log", s"main..$branch").!!
80+
// When running from forks, we don't currently check the commit messages on the branch
81+
val commits = Try(Seq("git", "log", s"main..$branch").!!).getOrElse("")
8182
val issueCloseKeywords =
8283
Seq("close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved")
8384
.map(w => s"($w)")

0 commit comments

Comments
 (0)