Skip to content

Commit 19a7ada

Browse files
authored
Merge pull request #538 from lukpueh/sigstore-ci
ci: file issue if sigstore test fails
2 parents 2142e4a + 115433c commit 19a7ada

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/test-sigstore.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ permissions: {}
1111
jobs:
1212
test-sigstore:
1313
runs-on: ubuntu-latest
14+
if: github.repository_owner == 'secure-systems-lab' # only run upstream
1415

1516
permissions:
1617
id-token: 'write' # ambient credential is used to sign
@@ -35,3 +36,25 @@ jobs:
3536
export CERT_ID=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/.github/workflows/test-sigstore.yml@${GITHUB_REF}
3637
export CERT_ISSUER=https://token.actions.githubusercontent.com
3738
tox -e sigstore
39+
40+
- name: File an issue on failure
41+
if: ${{ failure() }}
42+
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
43+
with:
44+
script: |
45+
const repo = context.repo.owner + "/" + context.repo.repo
46+
const issues = await github.rest.search.issuesAndPullRequests({
47+
q: "Sigstore+tests+failed+in:title+state:open+type:issue+repo:" + repo,
48+
})
49+
if (issues.data.total_count > 0) {
50+
console.log("Issue open already, not creating.")
51+
} else {
52+
await github.rest.issues.create({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
title: "Sigstore tests failed",
56+
body: "Hey, it seems Sigstore tests have failed, please see - [workflow run](" +
57+
"https://github.com/" + repo + "/actions/runs/" + context.runId + ")"
58+
})
59+
console.log("New issue created.")
60+
}

0 commit comments

Comments
 (0)