Skip to content

Instantly share code, notes, and snippets.

@DanPurdy
Created April 6, 2016 18:46
Show Gist options
  • Save DanPurdy/842dea0f0342afbdb426289df3c7c14a to your computer and use it in GitHub Desktop.
Save DanPurdy/842dea0f0342afbdb426289df3c7c14a to your computer and use it in GitHub Desktop.
Checks your eslint output (checkstyle formatted) for errors and reports the status back to github via the status API
## check for eslint errors.
if (grep -c 'severity=\"error\"' test-reports/*.xml 1> /dev/null 2>&1) then
curl -H "Authorization: token <YOUR-GITHUB-TOKEN-HERE>" \
--request POST \
--data \
'{
"state": "failure",
"context": "ESLint",
"description": "Lint errors present",
"target_url": "${bamboo.buildResultsUrl}"
}' \
https://GITHUB-URL/api/v3/repos/GITHUB-USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
else
curl -H "Authorization: token <YOUR-GITHUB-TOKEN-HERE>" \
--request POST \
--data \
'{
"state": "success",
"context": "ESLint",
"description": "Linted successfully",
"target_url": "${bamboo.buildResultsUrl}"
}' \
https://GITHUB-URL/api/v3/repos/GITHUB-USER/REPO/statuses/${bamboo.repository.revision.number} > /dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment