Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
mntlb committed Dec 23, 2019
0 parents commit 0d3d5ce
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# versioning-action

Action created for easier versioning in trunk-based flow

Parameters:
- `github_info` - `github` context of build
- `gist_token` - Github personal API token with `gist` scope (acts like back-end)

Outputs:
- step output `version`
- environment variable `VERSION` which will be available in flow
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Versioner

inputs:
github_info:
required: true
gist_token:
required: true

outputs:
version:
description: generated version

runs:
using: 'node12'
main: 'app.js'
16 changes: 16 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { env } = process;

const GITHUB_CONTEXT = JSON.parse(env.INPUT_GITHUB_INFO)
const GIST_TOKEN = env.INPUT_GIST_TOKEN

const { event_name: eventName } = GITHUB_CONTEXT;

switch (eventName) {
case 'pull_request':
pullRequestAction(GITHUB_CONTEXT);
}


function pullRequestAction(context) {
console.log('This is PR : ', context.event.number);
}

0 comments on commit 0d3d5ce

Please sign in to comment.