diff --git a/.github/workflows/dapr-bot.yml b/.github/workflows/dapr-bot.yml new file mode 100644 index 00000000..2252df48 --- /dev/null +++ b/.github/workflows/dapr-bot.yml @@ -0,0 +1,31 @@ +name: dapr-bot + +on: + issue_comment: {types: created} + + +jobs: + daprbot: + name: bot-processor + runs-on: ubuntu-latest + steps: + - name: Comment analyzer + uses: actions/github-script@v1 + with: + github-token: ${{secrets.DAPR_BOT_TOKEN}} + script: | + const payload = context.payload; + const issue = context.issue; + const isFromPulls = !!payload.issue.pull_request; + const commentBody = payload.comment.body; + if (!isFromPulls && commentBody && commentBody.indexOf("/assign") == 0) { + if (!issue.assignees || issue.assignees.length === 0) { + await github.issues.addAssignees({ + owner: issue.owner, + repo: issue.repo, + issue_number: issue.number, + assignees: [context.actor], + }) + } + return; + } diff --git a/documentation/assets/github_setting.png b/documentation/assets/github_setting.png new file mode 100644 index 00000000..50546e61 Binary files /dev/null and b/documentation/assets/github_setting.png differ diff --git a/documentation/development.md b/documentation/development.md index 01abb9f4..77768014 100644 --- a/documentation/development.md +++ b/documentation/development.md @@ -53,4 +53,15 @@ npm run test:e2e:http:actors ## Publishing -Publishing is automated in the CI/CD pipeline. Each time a version is release (GitHub ref starting with `refs/tags/v`) then the pipeline will deploy the package as described in [build.yml](./.github/workflows/build.yml). \ No newline at end of file +Publishing is automated in the CI/CD pipeline. Each time a version is release (GitHub ref starting with `refs/tags/v`) then the pipeline will deploy the package as described in [build.yml](./.github/workflows/build.yml). + +## Setup GitHub actions + +1. Fork the [js-sdk](https://github.com/dapr/js-sdk) repo to your GitHub account. +1. Go to `Settings` in the forked repo and click on `Secrets` -> `Action`: +![GitHub Settings](./assets/github_setting.png) +1. Add secret variables for Dapr CI + +|Secret|Value|Usage| +|--|--|--| +|DAPR_BOT_TOKEN|[Your Github Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)|[dapr-bot.yml](https://github.com/dapr/js-sdk/blob/master/.github/workflows/dapr-bot.yml) uses it for administrative actions|