Skip to content

Commit 9f7b852

Browse files
use github token as input (#5)
1 parent 2cba488 commit 9f7b852

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ jobs:
2424
type: now
2525
from_branch: development
2626
target_branch: staging
27-
env:
28-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
27+
github_token: ${{ github.token }}
2928

3029
- name: Merge staging -> uat
3130
uses: devmasx/[email protected]
3231
with:
3332
type: now
3433
from_branch: staging
3534
target_branch: uat
36-
env:
37-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
35+
github_token: ${{ github.token }}
3836
```
3937
4038
### Merge current branch
@@ -56,8 +54,7 @@ jobs:
5654
with:
5755
type: now
5856
target_branch: uat
59-
env:
60-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
57+
github_token: ${{ github.token }}
6158
```
6259
6360
### On labeled
@@ -85,6 +82,5 @@ jobs:
8582
with:
8683
label_name: 'merged in develop'
8784
target_branch: 'develop'
88-
env:
89-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
85+
github_token: ${{ github.token }}
9086
```

action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'Merge branch'
2-
description: 'A GitHub Action that merge PR branch to other branchs'
2+
description: 'A GitHub Action that manage git merge for any gitflow'
33
author: Miguel Savignano
44
inputs:
55
type:
@@ -18,6 +18,9 @@ inputs:
1818
head_to_merge:
1919
description: 'The branch name or hash to merge. default GITHUB_SHA'
2020
required: false
21+
github_token:
22+
description: 'Github token'
23+
required: true
2124
runs:
2225
using: 'docker'
2326
image: 'Dockerfile'

lib/index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@event = JSON.parse(File.read(ENV['GITHUB_EVENT_PATH']))
66
@head_to_merge = ENV['INPUT_HEAD_TO_MERGE'] || ENV['INPUT_FROM_BRANCH'] || ENV['GITHUB_SHA'] # or brach name
77
@repository = ENV['GITHUB_REPOSITORY']
8-
@github_token = ENV['GITHUB_TOKEN']
8+
@github_token = ENV['INPUT_GITHUB_TOKEN'] || ENV['GITHUB_TOKEN']
99

1010
inputs = {
1111
type: ENV['INPUT_TYPE'] || MergeBrachService::TYPE_LABELED, # labeled | comment | now

0 commit comments

Comments
 (0)