Skip to content

Commit 8d57a5b

Browse files
authored
Use checks to report built docs (#1998)
1 parent a3209a1 commit 8d57a5b

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: CI
22

3-
on:
4-
pull_request:
5-
push:
3+
on: [pull_request, push]
4+
5+
permissions:
6+
checks: write
67

78
env:
89
MIX_ENV: test
@@ -55,43 +56,29 @@ jobs:
5556
path: doc/
5657
overwrite: true
5758

58-
- name: Build update
59+
- name: Docs report
5960
uses: actions/github-script@v7
60-
if: github.event_name == 'pull_request'
61+
continue-on-error: true
6162
env:
6263
ARTIFACT_ID: ${{ steps.docs-upload.outputs.artifact-id }}
6364
with:
6465
script: |
6566
const artifactUrl = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}/artifacts/${process.env.ARTIFACT_ID}`;
66-
const commentBody = `<!-- build-artifact-comment -->\n📦 Docs artifacts are ready: ${artifactUrl}`;
6767
68-
const comments = await github.rest.issues.listComments({
68+
await github.rest.checks.create({
6969
owner: context.repo.owner,
7070
repo: context.repo.repo,
71-
issue_number: context.issue.number,
71+
name: 'Docs artifacts',
72+
head_sha: context.sha,
73+
status: 'completed',
74+
conclusion: 'success',
75+
output: {
76+
title: '',
77+
summary: '',
78+
text: artifactUrl
79+
}
7280
});
7381
74-
const botComment = comments.data.find(comment =>
75-
comment.user.type === 'Bot' &&
76-
comment.body.includes('<!-- build-artifact-comment -->')
77-
);
78-
79-
if (botComment) {
80-
await github.rest.issues.updateComment({
81-
owner: context.repo.owner,
82-
repo: context.repo.repo,
83-
comment_id: botComment.id,
84-
body: commentBody
85-
});
86-
} else {
87-
await github.rest.issues.createComment({
88-
owner: context.repo.owner,
89-
repo: context.repo.repo,
90-
issue_number: context.issue.number,
91-
body: commentBody
92-
});
93-
}
94-
9582
# Test Elixir
9683
- run: mix format --check-formatted
9784
- run: mix deps.unlock --check-unused

0 commit comments

Comments
 (0)