-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,009 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
parserOptions: | ||
ecmaVersion: 2017 | ||
|
||
env: | ||
es6: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: lint | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '17' | ||
- run: yarn install | ||
- run: yarn run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
# close-opsgenie-alert-action | ||
# Close OpsGenie alert action | ||
|
||
This action closes OpsGenie alert by providing an alert alias | ||
|
||
## Inputs | ||
|
||
`api_key` | ||
|
||
**Required** The api key provided by OpsGenie integration. | ||
|
||
`alias` | ||
|
||
**Required** The alias of the alert we want to close. | ||
|
||
`user` | ||
|
||
The actor of the close operation, by default it will be `github-action` | ||
|
||
`note` | ||
|
||
An added note to the close operation. | ||
|
||
## Example usage | ||
``` | ||
uses: rockem/[email protected] | ||
with: | ||
api_key: ${{ secrets.OPSGENIE_API_KEY }} | ||
alias: alert-alias | ||
user: [email protected] | ||
note: Closing alert as it's not relevant any more | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: close-opsgenie-alert | ||
description: Close an OpsGenie Alert | ||
inputs: | ||
api_key: | ||
description: OpsGenie API key | ||
required: true | ||
alias: | ||
description: Alias of the alert to close | ||
required: true | ||
user: | ||
description: OpsGenie Actor | ||
required: false | ||
default: github-action | ||
note: | ||
description: Close alert note | ||
required: false | ||
runs: | ||
using: 'node16' | ||
main: 'index.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const core = require('@actions/core'); | ||
const opsgenie = require('opsgenie-sdk'); | ||
|
||
opsgenie.configure({ | ||
'api_key': core.getInput('api_key') | ||
}); | ||
|
||
const alert_identifier = { | ||
identifier: core.getInput('alias'), | ||
identifierType: "alias" | ||
}; | ||
|
||
const close_alert_data = { | ||
note: core.getInput('note'), | ||
user: core.getInput('user') | ||
}; | ||
|
||
opsgenie.alertV2.close(alert_identifier, close_alert_data, function (error) { | ||
if (error) { | ||
core.setFailed(`ERROR: ${error.message}`); | ||
} else { | ||
console.log(`Request sent for closing alert with alias: ${core.getInput('alias')}`); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "close-opsgenie-alert-action", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"repository": "[email protected]:rockem/close-opsgenie-alert-action.git", | ||
"author": "Eli Segal <[email protected]>", | ||
"license": "MIT", | ||
"scripts": { | ||
"lint": "eslint . --fix --ext .js" | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.6.0", | ||
"opsgenie-sdk": "^0.5.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.7.0" | ||
} | ||
} |
Oops, something went wrong.