use github token as input (#5)

This commit is contained in:
Miguel Savignano 2020-07-22 17:27:43 +02:00 committed by GitHub
parent 2cba4884ae
commit 9f7b852908
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View File

@ -24,8 +24,7 @@ jobs:
type: now
from_branch: development
target_branch: staging
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
github_token: ${{ github.token }}
- name: Merge staging -> uat
uses: devmasx/merge-branch@v1.2.0
@ -33,8 +32,7 @@ jobs:
type: now
from_branch: staging
target_branch: uat
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
github_token: ${{ github.token }}
```
### Merge current branch
@ -56,8 +54,7 @@ jobs:
with:
type: now
target_branch: uat
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
github_token: ${{ github.token }}
```
### On labeled
@ -85,6 +82,5 @@ jobs:
with:
label_name: 'merged in develop'
target_branch: 'develop'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
github_token: ${{ github.token }}
```

View File

@ -1,5 +1,5 @@
name: 'Merge branch'
description: 'A GitHub Action that merge PR branch to other branchs'
description: 'A GitHub Action that manage git merge for any gitflow'
author: Miguel Savignano
inputs:
type:
@ -18,6 +18,9 @@ inputs:
head_to_merge:
description: 'The branch name or hash to merge. default GITHUB_SHA'
required: false
github_token:
description: 'Github token'
required: true
runs:
using: 'docker'
image: 'Dockerfile'

View File

@ -5,7 +5,7 @@ require_relative './services/merge_branch_service'
@event = JSON.parse(File.read(ENV['GITHUB_EVENT_PATH']))
@head_to_merge = ENV['INPUT_HEAD_TO_MERGE'] || ENV['INPUT_FROM_BRANCH'] || ENV['GITHUB_SHA'] # or brach name
@repository = ENV['GITHUB_REPOSITORY']
@github_token = ENV['GITHUB_TOKEN']
@github_token = ENV['INPUT_GITHUB_TOKEN'] || ENV['GITHUB_TOKEN']
inputs = {
type: ENV['INPUT_TYPE'] || MergeBrachService::TYPE_LABELED, # labeled | comment | now