Skip to content

Commit

Permalink
Add GitHub Actions Job Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
arnested committed May 9, 2022
1 parent 9f3cb5a commit 9a2dbd1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,11 @@ jobs:
```

![The workflow summary](docs/action-matrix-summary.png)

## Summary

The action writes a [GitHub Actions Job
Summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
with values it identified:

![Job summary](docs/job-summary.png)
Binary file added docs/job-summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ async function run(): Promise<void> {
core.info(`minimal go version: ${min} - from go.mod`)
core.info(`latest go version: ${lat} - from https://go.dev/dl/`)
core.info(`go version matrix: ${mat} - from https://go.dev/dl/`)

const htmlMat = mat
.map(v => `<a href="https://go.dev/doc/go${v}">Go ${v}</a>`)
.join('<br>')

await core.summary
.addTable([
[
{data: 'Output', header: true},
{data: 'Value', header: true}
],
['Module', `<a href="https://pkg.go.dev/${name}">${name}</a>`],
['Minimal', `<a href="https://go.dev/doc/go${min}">Go ${min}</a>`],
['Latest', `<a href="https://go.dev/doc/go${lat}">Go ${lat}</a>`],
['Matrix', `${htmlMat}`]
])
.write()
} catch (error) {
core.setFailed((error as Error).message)
}
Expand Down

0 comments on commit 9a2dbd1

Please sign in to comment.