Skip to content

Commit

Permalink
Try this
Browse files Browse the repository at this point in the history
  • Loading branch information
IAmJSD committed Sep 12, 2019
1 parent 9f703b3 commit da1f746
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.SPACES_REGION }}

- name: Leave a comment
run: node ./build/createGithubComment.js
env:
COMMIT_SHA: ${{ github.sha }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_ACCESS_TOKEN }}
SPACES_REGION: ${{ secrets.SPACES_REGION }}
SPACES_BUCKET: ${{ secrets.SPACES_BUCKET }}
21 changes: 21 additions & 0 deletions build/createGithubComment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const fetch = require("node-fetch")

const url = `https://${process.env.SPACES_BUCKET}.${process.env.SPACES_REGION}.digitaloceanspaces.com/${process.env.COMMIT_SHA}`

const comment = `This commit has been deployed to DigitalOcean Spaces for easy viewing. ([DNS Tool](${url}/dns-tool/index.html), [SPF Explainer](${url}/spf-explainer/index.html))`

fetch(
`https://api.github.com/repos/do-community/dns-tool/commits/${process.env.COMMIT_SHA}/comments`,
{
method: "POST",
body: JSON.stringify({
body: comment,
}),
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `Basic JakeMakesStuff:${(new Buffer(process.env.GITHUB_ACCESS_TOKEN)).toString("base64")}`,
}
},
).then(x => {
if (!x.ok) throw x
}).catch(e => { throw e })

1 comment on commit da1f746

@IAmJSD
Copy link
Contributor Author

@IAmJSD IAmJSD commented on da1f746 Sep 12, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been deployed to DigitalOcean Spaces for easy viewing. (DNS Tool, SPF Explainer)

Please sign in to comment.