Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
dhanvi committed Jul 28, 2020
0 parents commit 18d7fa7
Show file tree
Hide file tree
Showing 397 changed files with 128,285 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
#node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# import env from pr comment

A Github action to import environment variables from github pull request comment

## Usage

- Requires the `GITHUB_TOKEN` secret.
- Supports `pull_request` event types.

### Sample workflow

```yaml
on:
pull_request:

jobs:
example:
runs-on: ubuntu-latest
steps:
- name: example
uses: dhanvi/import-env-from-pr-comment@master
```
### Data in PR comment
* Data in below format is expected in the pr description, first comment only, if you need to update environment variable you can always update the description and re-trigger the action.
```
```json
{
"ENV1": "ENV_VALUE_1",
"ENV2": "ENV_VALUE_2",
}
```

* It is suggested to create a PR template in the repo by adding the above data in the file `.github/pull_request_template.md`
13 changes: 13 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'import env from pr comment'
author: Tummala Dhanvi <dhanvicse@gmail.com>
description: 'Github action to import environment variables from github pull request comment'
branding:
icon: 'git-pull-request'
color: 'blue'
inputs:
GITHUB_TOKEN:
description: 'Github token'
required: true
runs:
using: 'node12'
main: 'index.js'
34 changes: 34 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const core = require('@actions/core');
const github = require('@actions/github');
const codedown = require('codedown')

const context = github.context;

async function run() {
const repoToken = core.getInput('GITHUB_TOKEN');
const octokit = github.getOctokit(repoToken);

try {
const comment = await octokit.issues.get({
...context.repo,
issue_number: context.payload.number
});

body = comment.data.body
json_data = codedown(body, "json")
console.log(json_data)

json_data_parsed = JSON.parse(json_data)

for (const [key, value] of Object.entries(json_data_parsed)) {
core.exportVariable(key, value);
console.log(key, value);
}

} catch (ex) {
console.error(ex, context);
throw ex;
}
}

run();
1 change: 1 addition & 0 deletions node_modules/.bin/codedown

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/marked

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

146 changes: 146 additions & 0 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 18d7fa7

Please sign in to comment.