Skip to content

Commit 867f542

Browse files
authored
Fix publish job attempt 2 (#26)
1 parent ba2e612 commit 867f542

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

.github/index.pkl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ local publishJob: Workflow.Job = new {
100100
cache = "gradle"
101101
}
102102
}
103+
// check out again to write credentials to workspace (needed by publish task).
104+
new Common.Checkout {
105+
with {
106+
`fetch-depth` = 0
107+
`persist-credentials` = true
108+
}
109+
}
103110
new {
104111
env {
105112
["GH_TOKEN"] = Context.github.token

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ jobs:
3939
java-version: '21'
4040
distribution: temurin
4141
cache: gradle
42+
- uses: actions/checkout@v5
43+
with:
44+
persist-credentials: true
45+
fetch-depth: 0
4246
- name: Generate and publish docs
4347
env:
4448
GH_TOKEN: ${{ github.token }}

src/main/kotlin/org/pkl/package_docs/Main.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,19 @@ fun main(args: Array<String>) {
2626
val (owner, repo) = repoStr.split("/")
2727
Repo(owner, repo)
2828
}
29-
val docsGenerator = PackageDocs(gitRootDir, outputDir, repos)
30-
docsGenerator.generateDocs()
31-
if (doPublish) {
32-
docsGenerator.uploadDocs()
33-
}
29+
try {
30+
val docsGenerator = PackageDocs(gitRootDir, outputDir, repos)
31+
docsGenerator.generateDocs()
32+
if (doPublish) {
33+
docsGenerator.uploadDocs()
34+
}
3435
// hotfix: call `exitProcess` here to workaround something
3536
// causing the docs generator to hang.
3637
// TODO: figure out why this is hanging.
37-
exitProcess(0)
38+
} catch (e: Throwable) {
39+
System.err.println(e.stackTraceToString())
40+
exitProcess(1)
41+
} finally {
42+
exitProcess(0)
43+
}
3844
}

0 commit comments

Comments
 (0)