Added a bot-generated PR-comment with a simple status table
The littlefs CI is actually in a nice state that generates a lot of information about PRs (code/stack/struct changes, line/branch coverage changes, benchmark changes), but GitHub's UI has changed overtime to make CI statuses harder to find for some reason. This bot comment should hopefully make this information easy to find without creating too much noise in the discussion. If not, this can always be changed later.
This commit is contained in:
@@ -4,11 +4,15 @@ on:
|
||||
workflows: [test]
|
||||
types: [completed]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash -euv -o pipefail {0}
|
||||
|
||||
jobs:
|
||||
# forward custom statuses
|
||||
status:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
# custom statuses?
|
||||
- uses: dawidd6/action-download-artifact@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
@@ -53,3 +57,44 @@ jobs:
|
||||
target_url: env.TARGET_URL,
|
||||
}' | tee /dev/stderr)"
|
||||
done
|
||||
|
||||
# forward custom pr-comments
|
||||
comment:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
# only run on success (we don't want garbage comments!)
|
||||
if: ${{github.event.workflow_run.conclusion == 'success'}}
|
||||
|
||||
steps:
|
||||
# generated comment?
|
||||
- uses: dawidd6/action-download-artifact@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
workflow: ${{github.event.workflow_run.name}}
|
||||
run_id: ${{github.event.workflow_run.id}}
|
||||
name: comment
|
||||
path: comment
|
||||
- name: update-comment
|
||||
continue-on-error: true
|
||||
run: |
|
||||
ls comment
|
||||
for s in $(shopt -s nullglob ; echo comment/*.json)
|
||||
do
|
||||
export NUMBER="$(jq -er '.number' $s)"
|
||||
export BODY="$(jq -er '.body' $s)"
|
||||
|
||||
# check that the comment was from the most recent commit on the
|
||||
# pull request
|
||||
[ "$(curl -sS -H "authorization: token ${{secrets.BOT_TOKEN}}" \
|
||||
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pulls/$NUMBER" \
|
||||
| jq -er '.head.sha')" \
|
||||
== ${{github.event.workflow_run.head_sha}} ] || continue
|
||||
|
||||
# update comment
|
||||
curl -sS -X POST -H "authorization: token ${{secrets.BOT_TOKEN}}" \
|
||||
"$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/issues/`
|
||||
`$NUMBER/comments" \
|
||||
-d "$(jq -n '{
|
||||
body: env.BODY,
|
||||
}' | tee /dev/stderr)"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user