Skip to content

Commit

Permalink
fix: add context to golang ci lint notifications (#15979)
Browse files Browse the repository at this point in the history
* fix: add context to golang ci lint notifications

* feat: add artifact url to slack message
  • Loading branch information
erikburt authored Jan 18, 2025
1 parent dc46808 commit 16d4874
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ inputs:
description: Set where the go module file is located at
default: "go.sum"

outputs:
golang-report-artifact-url:
description: The URL to the uploaded artifact
value: ${{ steps.upload-artifact.outputs.artifact_url }}

runs:
using: composite
steps:
Expand Down Expand Up @@ -100,6 +105,7 @@ runs:
- name: Store Golangci-lint report artifact
if: always()
id: upload-artifact
uses: actions/[email protected]
with:
# Use a unique suffix for each lint report artifact to avoid duplication errors
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ jobs:
with:
persist-credentials: false
- name: Golang Lint (${{ matrix.modules }})
id: golang-lint
uses: ./.github/actions/golangci-lint
with:
go-directory: ${{ matrix.modules }}
Expand All @@ -156,7 +157,10 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
with:
channel-id: "#team-core"
slack-message: "golangci-lint failed: \n${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}"
slack-message: |
"golangci-lint failed (${{ matrix.modules }})
- Run: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}"
- Report: ${{ steps.golang-lint.outputs.golang-report-artifact-url }}"
# Fails if any golangci-lint matrix jobs fails and silently succeeds otherwise
# Consolidates golangci-lint matrix job results under one required `lint` check
Expand Down

0 comments on commit 16d4874

Please sign in to comment.