Skip to content

Commit

Permalink
fix(github): handle commit not found error
Browse files Browse the repository at this point in the history
When determining the changeset for incremental uploads but the local commit hash cannot be found on the remote
the error github:commit-not-found is raised.
  • Loading branch information
line-o committed Apr 23, 2024
1 parent 9897d6a commit f7df126
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/github.xql
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,14 @@ declare function github:get-newest-commits($config as map(*)) as xs:string* {
let $commits := github:get-raw-commits($config, 100)
let $shas := array:for-each($commits, github:only-commit-shas#1)?*
let $how-many := index-of($shas?1, $deployed) - 1
return reverse(subsequence($shas?2, 1, $how-many))
return
if (empty($how-many)) then (
error(
xs:QName("github:commit-not-found"),
'The deployed commit hash ' || $deployed || ' was not found in the list of commits on the remote.')
) else (
reverse(subsequence($shas?2, 1, $how-many))
)
};

(:~
Expand Down

0 comments on commit f7df126

Please sign in to comment.