Skip to content

Commit

Permalink
feat(action): Updated readme & removed unnecessary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Sep 28, 2021
1 parent e35f83a commit 7c90a39
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 11 deletions.
102 changes: 98 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

This actions toggle labels like "awaiting-reply" or "need-more-info" which indicates response is required for further action. This is useful if you want to filter out issue already responded to the issue author but the author isn't responded back.

**Usecase:**
Mostly in premium product or service customer support is top priority. In this scenario customer may create issue and sales team replies back withing their business days. This action really helps in filtering only those issues which requires sales teams response. Those issue which are already answered/responded will be marked via `awaiting-reply` or `need-more-info`.
**Use case:**
Mostly in premium product or service customer support is top priority. In this scenario customer may create issue and sales team replies back withing their business days. This action really helps in filtering only those issues which requires sales teams response. Those issue which are already answered/responded will be marked via "awaiting-reply" or "need-more-info".

This is same of large open source community where an individual what to help people and want to check only those issues where no team member responded yet.

> *This action is highly inspired by already existing action [pending-response](https://github.com/siegerts/pending-response) by [siegerts](https://github.com/siegerts)*
## Inputs

### `token`*
### `token`

GitHub personal token
#### *Default: ${{ github.token }}*

GitHub token

### `label`*

Expand Down Expand Up @@ -47,6 +49,98 @@ Ignore operation if commented by team members specified in `exclude-members`. Th
## Example Usage

> NOTE: Do update action version `jd-0001/gh-action-toggle-awaiting-reply-label@{YOUR_DESIRED_VERSION}`. This will help you keep using this action if we introduce breaking changes.
### Toggle specified label on each issue

```yml
on:
issue_comment:
types: [created]

jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Job for toggling label
steps:
- name: Toggle label
uses: jd-0001/[email protected]
with:
label: question
```
### Remove specified label only if repo owner or member comment on issue (not collaborator)
```yml
on:
issue_comment:
types: [created]

jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Job for toggling label
steps:
- name: Toggle label
uses: jd-0001/[email protected]
with:
label: question
member-association: OWNER, MEMBER
```
### Ignore toggling label if specified label is present on issue
```yml
on:
issue_comment:
types: [created]

jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Job for toggling label
steps:
- name: Toggle label
uses: jd-0001/[email protected]
with:
label: question
ignore-label: internal
```
### Only toggle label if specified label is present on issue
```yml
on:
issue_comment:
types: [created]

jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Job for toggling label
steps:
- name: Toggle label
uses: jd-0001/[email protected]
with:
label: question
only-if-label: support
```
### Ignore removing label if mentioned users comment on issue and still present in `member-association`

```yml
on:
issue_comment:
types: [created]
jobs:
hello_world_job:
runs-on: ubuntu-latest
name: Job for toggling label
steps:
- name: Toggle label
uses: jd-0001/[email protected]
with:
label: question
exclude-members: jd-0001, johnDoe123
```
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: 'Toggle awaiting-reply label of issue'
description: 'Toggle awaiting-reply or any label when issue author or team member comment on issue.'
author: jd-0001
branding:
icon: award
color: purple
inputs:
token:
description: "GitHub personal token"
description: "GitHub token"
required: false
default: ${{ github.token }}
label:
Expand Down
6 changes: 3 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8384,8 +8384,8 @@ const hasLabel = (issue, label) => {
const octokit = getOctokit()
const ctx = github.context

console.log(`ctx.eventName: ${ctx.eventName}`)
console.log(`Payload: ${JSON.stringify(ctx.payload, undefined, 2)}`)
// console.log(`ctx.eventName: ${ctx.eventName}`)
// console.log(`Payload: ${JSON.stringify(ctx.payload, undefined, 2)}`)

// Docs: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

Expand All @@ -8411,7 +8411,7 @@ const hasLabel = (issue, label) => {
repo: ctx.repo.repo,
})

console.log("Issue:", JSON.stringify(issue, undefined, 2))
// console.log("Issue:", JSON.stringify(issue, undefined, 2))

// If issue is closed => return
if (issue.state === "closed") return
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const hasLabel = (issue, label) => {
const octokit = getOctokit()
const ctx = github.context

console.log(`ctx.eventName: ${ctx.eventName}`)
console.log(`Payload: ${JSON.stringify(ctx.payload, undefined, 2)}`)
// console.log(`ctx.eventName: ${ctx.eventName}`)
// console.log(`Payload: ${JSON.stringify(ctx.payload, undefined, 2)}`)

// Docs: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows

Expand All @@ -73,7 +73,7 @@ const hasLabel = (issue, label) => {
repo: ctx.repo.repo,
})

console.log("Issue:", JSON.stringify(issue, undefined, 2))
// console.log("Issue:", JSON.stringify(issue, undefined, 2))

// If issue is closed => return
if (issue.state === "closed") return
Expand Down

0 comments on commit 7c90a39

Please sign in to comment.