Skip to content

Commit

Permalink
Add slack notification step for nightly run failures (#43)
Browse files Browse the repository at this point in the history
* Create linux arm64 binary after every release

Signed-off-by: thepetk <thepetk@gmail.com>

* Add darwin arm64 to release binaries

Signed-off-by: thepetk <thepetk@gmail.com>

* Implement slack notification for nightly run failure

Signed-off-by: thepetk <thepetk@gmail.com>

* Fix message text

Signed-off-by: thepetk <thepetk@gmail.com>

* Specify alizer as project of the message

Signed-off-by: thepetk <thepetk@gmail.com>

* Pin all github action dependencies

Signed-off-by: thepetk <thepetk@gmail.com>

* Update secret name

Signed-off-by: thepetk <thepetk@gmail.com>

* Confirm that the github_event is scheduled

Signed-off-by: thepetk <thepetk@gmail.com>

* Update the head_ref to simple ref in workflow

Signed-off-by: thepetk <thepetk@gmail.com>

* Add github.sha to slack notification

Signed-off-by: thepetk <thepetk@gmail.com>

* Add code blocks for ref and sha

Signed-off-by: thepetk <thepetk@gmail.com>

---------

Signed-off-by: thepetk <thepetk@gmail.com>
  • Loading branch information
thepetk authored Jan 18, 2024
1 parent 80061c4 commit dc7f5e9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Setup Go environment
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.19'

Expand Down Expand Up @@ -56,14 +56,14 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: 1.19
- name: Run tests
run: make test
- name: Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
44 changes: 39 additions & 5 deletions .github/workflows/check_registry.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
schedule:
- cron: "0 3 * * *"
- cron: "0 3 * * *"

name: Product & Community Registries Check

Expand All @@ -14,22 +14,56 @@ permissions:
jobs:
check-registry:
name: Check registry entries
runs-on: 'ubuntu-latest'
runs-on: "ubuntu-latest"
outputs:
matrix: ${{ steps.get-stacks.outputs.matrix }}
steps:
- name: Checkout code
id: checkout-code
uses: actions/checkout@v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Setup go
id: setup-go
uses: actions/setup-go@v4
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.19.5'
go-version: "1.19.5"
- name: Run registries check
id: build
run: |
make build
make check_registry
- name: Send slack notification
if: ${{ failure() && github.event_name == 'schedule' }}
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 # v1.24.0
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
payload: |
{
"text": "GitHub Action failed",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Status:* :red_circle: failure\n*Severity:* medium\n*Title:* Alizer's product & community registries nightly run\n*Description:* run failed for `${{ github.ref }}` - `${{ github.sha }}`"
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": ":github: Failed action"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
- 'windows/amd64'
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.19.5'
- name: Get OS and arch info
Expand All @@ -53,7 +53,7 @@ jobs:
run: |
go build -o "$BINARY_NAME" -v
- name: Release with Notes and Binaries
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
draft: false
files: ${{env.BINARY_NAME}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/stale@v7
- uses: actions/stale@6f05e4244c9a0b2ed3401882b05d701dd0a7289b # v7.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: "This issue is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 60 days."
Expand Down

0 comments on commit dc7f5e9

Please sign in to comment.