-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add instructions for developing with a local version of the action (#250
- Loading branch information
Showing
7 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Rename this file to .env and update any variables to get started | ||
|
||
SLACK_BOT_TOKEN=xoxb-01010101-abcdefgh | ||
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T0123456789/B0123456789/abcdefghijklmnopqrstuvwxyz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Secret variables | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Local runs | ||
|
||
For a simple development experience, a local version of this action can be used in experiments. | ||
|
||
**Requirements**: | ||
|
||
- An installation of [nektos/act](https://github.com/nektos/act) | ||
|
||
## Configuring secrets | ||
|
||
To use `${{ secrets.* }}` in the workflow, move `.env.example` to `.env` and update any variables. | ||
|
||
## Mocking event payloads | ||
|
||
Different event payloads can be mocked directly with changes to the `event.json` file. | ||
|
||
Reference: https://docs.github.com/en/webhooks/webhook-events-and-payloads | ||
|
||
## Updating the workflow | ||
|
||
The `local.yml` file contains the workflow used for testing. Updates to these steps can be made to test various functionalities. | ||
|
||
## Running an experiment | ||
|
||
Run the workflow using `npm run local`. The above configurations will be used to simulate an actual workflow run. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"pull_request": { | ||
"user": { | ||
"login": "dependabot" | ||
}, | ||
"title": "Bump actions/checkout from 3 to 4", | ||
"html_url": "https://github.com/slackapi/slack-github-action/pull/238" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Local run | ||
|
||
# Requires mocking the "public" event to begin this workflow and avoid actual runs | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows | ||
on: | ||
public: | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout action | ||
uses: actions/checkout@v4 | ||
- name: Build action | ||
run: npm install && npm run build | ||
- name: Send a message into channel | ||
id: slack | ||
uses: ./. | ||
with: | ||
payload: | | ||
{ | ||
"repository": "${{ github.repository }}", | ||
"pull_request_username": "${{ github.event.pull_request.user.login }}", | ||
"pull_request_title": ${{ toJSON(github.event.pull_request.title) }}, | ||
"pull_request_url": "${{ github.event.pull_request.html_url }}" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters