Skip to content

Commit f722491

Browse files
authored
Merge pull request #12 from kyagi/add-usage-on-github-actions
Update README.md
2 parents ae69688 + fad21bf commit f722491

File tree

2 files changed

+67
-3
lines changed

2 files changed

+67
-3
lines changed

.github/workflows/labeling.yml renamed to .github/workflows/shamshir.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ jobs:
1414
- run: echo "🌙 Shamshir was automatically triggered by a ${{ github.event_name }} event."
1515
- uses: actions/checkout@v2
1616
- run: npm install
17-
- run: npm cache clean -f
1817
- id: shamshir-run
19-
uses: kyagi/shamshir@main
18+
uses: kyagi/shamshir@v1
2019
with:
2120
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2221
owner: ${{ github.repository_owner }}

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,69 @@ $ node shamshir.js --owner kyagi --repo awesome-project --label releasable --quo
6868
--help Show help
6969
```
7070
### On Github Actions
71-
TBD
71+
#### Setup
72+
1. Place action.yml in your project top directory.
73+
74+
action.yml
75+
```
76+
name: 'Shamshir'
77+
description: 'Attach a label to pull requests based on the number of approvals'
78+
author: 'Your name'
79+
80+
inputs:
81+
GITHUB_TOKEN:
82+
description: 'GitHub token'
83+
required: true
84+
owner:
85+
description: 'Github repository owner'
86+
required: true
87+
repo:
88+
description: 'Github repository'
89+
required: true
90+
label:
91+
description: 'Github label'
92+
required: true
93+
quorum:
94+
description: 'The quorum of approval'
95+
required: true
96+
97+
outputs:
98+
log:
99+
description: 'shamshir-run log message for github actions'
100+
101+
runs:
102+
using: 'node16'
103+
main: 'dist/index.js'
104+
```
105+
106+
2. Place shamshir.yml in your .github/workflows directory.
107+
108+
shamshir.yml
109+
```
110+
name: Shamshir
111+
on:
112+
pull_request_review:
113+
types: [submitted, edited, dismissed]
114+
pull_request:
115+
types: [edited, labeld, unlabeled]
116+
# schedule:
117+
# - cron: '0,30 0-10 * * 1-5'
118+
119+
jobs:
120+
Labeling:
121+
runs-on: ubuntu-latest
122+
steps:
123+
- run: echo "🌙 Shamshir was automatically triggered by a ${{ github.event_name }} event."
124+
- uses: actions/checkout@v2
125+
- run: npm install
126+
- id: shamshir-run
127+
uses: kyagi/shamshir@v1
128+
with:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
owner: ${{ github.repository_owner }}
131+
repo: ${{ github.repository }}
132+
label: 'releasable'
133+
quorum: '1'
134+
- run: echo "${{ steps.shamshir-run.outputs.log }}"
135+
- run: echo "🌙 Shamshir's status is ${{ job.status }}."
136+
```

0 commit comments

Comments
 (0)