Skip to content

Commit dddea80

Browse files
committed
initial
Signed-off-by: js-jake <[email protected]>
0 parents  commit dddea80

File tree

5 files changed

+185
-0
lines changed

5 files changed

+185
-0
lines changed

.gitignore

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
2+
# Created by https://www.toptal.com/developers/gitignore/api/node
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=node
4+
5+
### Node ###
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# TypeScript v1 declaration files
50+
typings/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional stylelint cache
62+
.stylelintcache
63+
64+
# Microbundle cache
65+
.rpt2_cache/
66+
.rts2_cache_cjs/
67+
.rts2_cache_es/
68+
.rts2_cache_umd/
69+
70+
# Optional REPL history
71+
.node_repl_history
72+
73+
# Output of 'npm pack'
74+
*.tgz
75+
76+
# Yarn Integrity file
77+
.yarn-integrity
78+
79+
# dotenv environment variables file
80+
.env
81+
.env.test
82+
.env*.local
83+
84+
# parcel-bundler cache (https://parceljs.org/)
85+
.cache
86+
.parcel-cache
87+
88+
# Next.js build output
89+
.next
90+
91+
# Nuxt.js build / generate output
92+
.nuxt
93+
dist
94+
95+
# Storybook build outputs
96+
.out
97+
.storybook-out
98+
storybook-static
99+
100+
# rollup.js default build output
101+
dist/
102+
103+
# Gatsby files
104+
.cache/
105+
# Comment in the public line in if your project uses Gatsby and not Next.js
106+
# https://nextjs.org/blog/next-9-1#public-directory-support
107+
# public
108+
109+
# vuepress build output
110+
.vuepress/dist
111+
112+
# Serverless directories
113+
.serverless/
114+
115+
# FuseBox cache
116+
.fusebox/
117+
118+
# DynamoDB Local files
119+
.dynamodb/
120+
121+
# TernJS port file
122+
.tern-port
123+
124+
# Stores VSCode versions used for testing VSCode extensions
125+
.vscode-test
126+
127+
# Temporary folders
128+
tmp/
129+
temp/
130+
131+
# End of https://www.toptal.com/developers/gitignore/api/node

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: "Git PR Source Branch"
2+
description: "Gets the source branch of a pull request from the github actions context"
3+
branding:
4+
icon: "git-branch"
5+
color: "purple"
6+
runs:
7+
using: "node14"
8+
main: index.js

index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { exportVariable, setFailed } from "@actions/core";
2+
import { readFileSync } from "fs";
3+
4+
try {
5+
const context = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH));
6+
const branch = context.pull_request.head.ref;
7+
exportVariable("SOURCE_BRANCH", branch);
8+
} catch (err) {
9+
setFailed(err.message);
10+
}

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "get-pr-source-branch",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"type": "module",
10+
"repository": {
11+
"type": "git",
12+
"url": "git+https://github.com/JS-Jake/get-pr-source-branch.git"
13+
},
14+
"author": "",
15+
"license": "ISC",
16+
"bugs": {
17+
"url": "https://github.com/JS-Jake/get-pr-source-branch/issues"
18+
},
19+
"homepage": "https://github.com/JS-Jake/get-pr-source-branch#readme",
20+
"dependencies": {
21+
"@actions/core": "^1.3.0"
22+
}
23+
}

0 commit comments

Comments
 (0)