Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sazap10 committed May 15, 2019
0 parents commit 81d427d
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM alpine:3.9

LABEL "name"="Bugsnag Build Reporting"
LABEL "maintainer"="Sachin Pande <[email protected]>"
LABEL "version"="1.0.0"

LABEL "com.github.actions.name"="Bugsnag build reporting"
LABEL "com.github.actions.description"="Reports application build to Bugsnag"
LABEL "com.github.actions.icon"="send"
LABEL "com.github.actions.color"="blue"

LABEL "repository"="https://github.com/sazap10/bugsnag-builds-action"
LABEL "homepage"="https://github.com/sazap10/bugsnag-builds-action"

RUN apk add curl

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Sachin Pande

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Bugsnag build reporting action
GitHub Action for reporting builds to Bugsnag using the Build API. This action will use the Github tag for the version by default. For more information about the Build API, see [here](https://docs.bugsnag.com/api/build/)

## Usage
```
action "Filter tag" {
uses = "actions/bin/filter@master"
args = "tag"
}
action "Report build" {
needs = "Filter tag"
uses = "sazap10/bugsnag-builds-action@master"
secrets = ["BUGSNAG_API_KEY"]
}
```

### Secrets
* `BUGSNAG_API_KEY` *Required* - The notifier API key of the project.

### Environment variables
* `BUILD_API_URL` *(optional)* - Overrides the default build API url. Defaults to `https://build.bugsnag.com`
* `RELEASE_STAGE` *(optional)* - Overrides the default release stage. Defaults to `production`
* `BUILDER_NAME` *(optional)* - Overrides the default builder name. Defaults to `Bugsnag build reporting`
* `METADATA` *(optional)* - Overrides the default metadata. This should be valid JSON. Defaults to `{}`.
* `AUTO_ASSIGN_RELEASE` *(optional)* - Flag indicating whether to automatically associate this build with any new error events and sessions that are received for the release stage until a subsequent build notification is received for the release stage. Defaults to `false`
* `VERSION` *(optional)* - Overrides the default reported app version. Defaults to the Github tag.

## License
The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).
26 changes: 26 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

set -e

URL=${BUILD_API_URL:-"https://build.bugsnag.com"}
RELEASE_STAGE=${RELEASE_STAGE:-production}
BUILDER_NAME=${BUILDER_NAME:-$GITHUB_ACTION}
METADATA=${METADATA:-"{}"}
AUTO_ASSIGN_RELEASE=${AUTO_ASSIGN_RELEASE:-false}
VERSION=${VERSION:-$GITHUB_REF}

echo curl $URL \
--header "Content-Type: application/json" \
--data '{
"apiKey": "'${BUGSNAG_API_KEY}'",
"appVersion": "'${VERSION}'",
"releaseStage": "'${RELEASE_STAGE}'",
"autoAssignRelease": "'${AUTO_ASSIGN_RELEASE}'",
"builderName": "'${BUILDER_NAME}'",
"sourceControl": {
"provider": "github",
"repository": "'https://github.com/${GITHUB_REPOSITORY}'",
"revision": "'${GITHUB_SHA}'"
},
"metadata": '${METADATA}'
}'

0 comments on commit 81d427d

Please sign in to comment.