Skip to content

Commit

Permalink
feat: fill issue for every broken nightly build
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Jul 29, 2021
1 parent 5277083 commit ae80100
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
runs-on: "ubuntu-latest"
needs: prepare-matrix
strategy:
max-parallel: 4 # avoid using all workers from the pool
max-parallel: 15 # avoid using all workers from the org pool
fail-fast: false
matrix:
dist_name: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
dist_name: ['ipfs-pack'] # TODO ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v2
- name: Setup IPFS
Expand All @@ -44,6 +44,43 @@ jobs:
timeout-minutes: 5
- run: cd ./dists/${{ matrix.dist_name }} && make nightly
- run: ./dockerized make publish
- name: Create issue if build failed
uses: actions/github-script@v4
if: ${{ failure() }}
with:
script: |
const title = 'Nightly build failed for ${{ matrix.dist_name }}'
const body = '${{ matrix.dist_name }} failed to build nightly from revision ${{ github.sha }}: https://github.com/ipfs/distributions/actions/runs/${{ github.run_id }}'
const opts = { owner: context.repo.owner, repo: context.repo.repo }
const response = await github.search.issuesAndPullRequests({
q: `repo:ipfs/distributions is:issue is:open in:title ${title}`
})
console.log('github.issuesAndPullRequests', response)
let link
if (response.data.items.length === 0) {
const created = await github.issues.create({ ...opts, title, body,
labels: ['kind/bug', 'need/triage']
})
console.log('no open issues, created a new one', created)
link = created.html_url
}
for (const issue of response.data.items) {
if (issue.title !== title) continue
console.log('found existing open issue', issue)
const created = await github.issues.createComment({ ...opts,
issue_number: issue.number,
body
})
console.log('commented on existing open issue', created)
link = created.html_url
}
await github.repos.createCommitStatus({ ...opts,
sha: '${{ github.sha }}',
state: 'error',
target_url: link,
context: 'Problem with ${{ matrix.dist_name }}',
description: 'See details in the linked issue'
})
- name: Inspect git status and contents of ./releases
run: git status && ls -Rhl ./releases
- name: Read CID of updated DAG
Expand Down

0 comments on commit ae80100

Please sign in to comment.