-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support for GitHub Actions (#36)
* Create .dockerignore * Create Dockerfile * Create entrypoint.sh * Updated permissions entrypoint * Create action.js * Update action.js * Update entrypoint.sh * Update action.js * Update action.js * Added octokit to action * Update package.json * Added err variable * Update Dockerfile * Update README.md
- Loading branch information
Showing
7 changed files
with
72 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 @@ | ||
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM node:10.11.0-alpine | ||
|
||
LABEL "com.github.actions.name"="Delete merged branch" | ||
LABEL "com.github.actions.description"="No more manually deleting merged branches, this lovely app does it for you." | ||
LABEL "com.github.actions.icon"="archive" | ||
LABEL "com.github.actions.color"="red" | ||
|
||
LABEL "repository"="https://github.com/SvanBoxel/delete-merged-branch" | ||
LABEL "homepage"="https://github.com/SvanBoxel" | ||
LABEL "maintainer"="[email protected]" | ||
|
||
COPY ./lib /delete-merged-branch-action | ||
COPY ./package.json /delete-merged-branch-action/package.json | ||
COPY ./entrypoint.sh /delete-merged-branch-action/entrypoint.sh | ||
|
||
ENTRYPOINT ["/delete-merged-branch-action/entrypoint.sh"] |
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
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,4 @@ | ||
#!/bin/sh -l | ||
|
||
npm --prefix /delete-merged-branch-action install /delete-merged-branch-action | ||
node /delete-merged-branch-action/action.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,27 @@ | ||
const fs = require('fs'); | ||
const octokit = require('@octokit/rest')() | ||
const deleteMergedBranch = require('./delete-merged-branch'); | ||
|
||
fs.readFile('/github/workflow/event.json', 'utf8', function(err, contents) { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
const payload = JSON.parse(contents); | ||
const context = { | ||
payload: payload, | ||
log: console, | ||
github: octokit | ||
} | ||
|
||
if (payload.action === 'closed') { | ||
octokit.authenticate({ | ||
type: 'token', | ||
token: process.env.GITHUB_TOKEN | ||
}) | ||
|
||
return deleteMergedBranch(context) | ||
} | ||
console.log('no closed event') | ||
}); | ||
|
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
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 |
---|---|---|
|
@@ -27,6 +27,20 @@ | |
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.0.tgz#50c1e2260ac0ed9439a181de3725a0168d59c48a" | ||
|
||
"@octokit/[email protected]": | ||
version "15.16.1" | ||
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.16.1.tgz#399b06660fe16852cf432059c845d4cdcaf77f5a" | ||
dependencies: | ||
before-after-hook "^1.1.0" | ||
btoa-lite "^1.0.0" | ||
debug "^3.1.0" | ||
http-proxy-agent "^2.1.0" | ||
https-proxy-agent "^2.2.0" | ||
lodash "^4.17.4" | ||
node-fetch "^2.1.1" | ||
universal-user-agent "^2.0.0" | ||
url-template "^2.0.8" | ||
|
||
"@octokit/rest@^15.13.1": | ||
version "15.13.1" | ||
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-15.13.1.tgz#68b12ff0e470ad70c90e99bbb69f16bcdf62edb4" | ||
|