Skip to content

Commit 9c6e65a

Browse files
authored
Merge 50c6042 into 1a999d6
2 parents 1a999d6 + 50c6042 commit 9c6e65a

File tree

13 files changed

+1044
-9
lines changed

13 files changed

+1044
-9
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "Checks whether a PR is buildpack related"
2+
description: "Checks whether a PR is buildpack related"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
default: ""
8+
runs:
9+
using: "node12"
10+
main: "dist/index.js"
11+

.github/actions/buildpack-pr-check/package-lock.json

Lines changed: 394 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "buildpack-pr-comment",
3+
"version": "1.0.0",
4+
"description": "An action that checks whether a pr was buildpack related",
5+
"private": true,
6+
"main": "index.js",
7+
"scripts": {
8+
"build": "tsc"
9+
},
10+
"keywords": [],
11+
"author": "Alexander Arlt",
12+
"license": "MIT",
13+
"dependencies": {
14+
"@actions/core": "^1.2.4",
15+
"@actions/github": "^2.1.1"
16+
},
17+
"devDependencies": {
18+
"typescript": "^3.8.3"
19+
}
20+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import * as core from "@actions/core";
2+
import * as github from "@actions/github";
3+
4+
async function run() {
5+
const token = core.getInput("token");
6+
7+
const octokit = new github.GitHub(token);
8+
const context = github.context;
9+
10+
const comments = await octokit.issues.listComments({
11+
...context.repo,
12+
issue_number: context.payload.pull_request!.number
13+
});
14+
15+
const actionComment = comments.data.find(
16+
comment => comment.body.indexOf("Package: ") >= 0 &&
17+
comment.body.indexOf("Version: ") >= 0 &&
18+
comment.body.indexOf("Action: ") >= 0 &&
19+
comment.body.indexOf("Artifact: ") >= 0 &&
20+
comment.body.indexOf("Commit: ") >= 0
21+
);
22+
23+
pack = actionComment.body.substr(comment.body.indexOf("Package: ") + 9)
24+
pack = pack.subst(pack.indexOf("\n"));
25+
version = actionComment.body.substr(comment.body.indexOf("Version: ") + 9)
26+
version = version.subst(version.indexOf("\n"));
27+
action = actionComment.body.substr(comment.body.indexOf("Action: ") + 8)
28+
action = action.subst(action.indexOf("\n"));
29+
artifact = actionComment.body.substr(comment.body.indexOf("Artifact: ") + 10)
30+
artifact = artifact.subst(artifact.indexOf("\n"));
31+
commit = actionComment.body.substr(comment.body.indexOf("Commit: ") + 8)
32+
33+
core.setOutput("package", pack.trim());
34+
core.setOutput("version", version.trim());
35+
core.setOutput("action", action.trim());
36+
core.setOutput("artifact", artifact.trim());
37+
core.setOutput("commit", commit.trim());
38+
39+
console.log("package", pack.trim());
40+
console.log("version", version.trim());
41+
console.log("action", action.trim());
42+
console.log("artifact", artifact.trim());
43+
console.log("commit", commit.trim());
44+
}
45+
46+
run();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "commonjs",
5+
"strict": true,
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"outDir": "dist"
9+
}
10+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Add comment to current PR"
2+
description: "Adds a comment to current PR"
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
default: ""
8+
action-id:
9+
description: "GitHub Action ID"
10+
required: true
11+
default: ""
12+
package-name:
13+
description: "Name of the package being released"
14+
required: true
15+
default: "Something like buildpack-ubuntu2004"
16+
package-version:
17+
description: "Version of the package being released"
18+
required: true
19+
default: "Something like 1.0.0"
20+
artifact:
21+
description: "Name of the artifact"
22+
required: true
23+
default: "Something like buildpack-ubuntu2004-d12f0d12c9f69baa7b825033b2f9c89acea738bf1ae734efa4b343833f897e1d"
24+
runs:
25+
using: "node12"
26+
main: "dist/index.js"

0 commit comments

Comments
 (0)