Skip to content

stewart42/action-comment-dispatch

Repository files navigation

Action Comment Dispatch

Usage

Action inputs

Name Description
GITHUB_TOKEN A repo scoped GitHub Personal Access Token.
prefix Comment must start with this value, eg: @bot
trigger The text in the comment to trigger the repository dispatch, eg deploy
event_type The custom event_type to send with when triggering the repository dispatch
- uses: stewart42/action-comment-dispatch@main
  with:
    GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
    prefix: 'bot'
    trigger: 'format'
    event_type: 'format'

GITHUB_TOKEN

This action creates repository_dispatch events. The default GITHUB_TOKEN does not have scopes to do this so a repo scoped PAT created on a user with write access to the target repository is required. If you will be dispatching to a public repository then you can use the more limited public_repo scope.

Developer setup

Install the dependencies

npm install

Build the typescript and package it for distribution

npm run build && npm run package

Run the tests ✔️

npm test

 PASS  ./index.test.js
  ✓ throws invalid number (3ms)
  ✓ wait 500 ms (504ms)
  ✓ test runs (95ms)

...

See the toolkit documentation for the various packages.

Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.

Then run ncc and push the results:

npm run package
git add dist
git commit -a -m "prod dependencies"
git push origin releases/v1

Your action is now published! 🚀

See the versioning documentation

Validate & Testing

You can now validate the action by referencing ./ in a workflow in your repo (see test.yml)

uses: ./
with:
  GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
  prefix: 'bot'
  trigger: 'format'
  event_type: 'format'

See the actions tab for runs of this action! 🚀

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published