Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ae50e2e
feat: cli
zimeg Feb 25, 2026
165d9f6
feat: cli
zimeg Feb 25, 2026
2d8c996
fix: echo output
zimeg Feb 25, 2026
077f882
ci: use development build
zimeg Feb 25, 2026
35b8102
fix: add to windows path
zimeg Feb 25, 2026
5d5197b
ci: remove feature build cli version
zimeg Feb 25, 2026
613ab73
test: verbose version
zimeg Feb 25, 2026
47ed37c
fix: run windows build in powershell
zimeg Feb 25, 2026
4e7d5d3
ci: dev
zimeg Feb 25, 2026
f50140b
ci: debug
zimeg Feb 25, 2026
b48e5cf
ci: tee output
zimeg Feb 25, 2026
32371dd
test: write empty credentials for windows tests for io speed
zimeg Feb 25, 2026
059f8f3
test: attempt to create all windows files or quit
zimeg Feb 25, 2026
eaed8db
build: use .net api for better diagnostics
zimeg Feb 25, 2026
65f25ff
test: remove debug from windows
zimeg Feb 25, 2026
4b307de
chore: remove verbose flag option
zimeg Feb 25, 2026
2d3baa1
fix: remove duplicate output for unix
zimeg Feb 25, 2026
c6baa4b
test: improve checks of existing cache or path
zimeg Feb 25, 2026
8607d1d
test: latest cli release
zimeg Feb 27, 2026
d343286
style: prefix steps with a shell format
zimeg Feb 28, 2026
e2bce82
style: make more clear other steps with mirrored shells
zimeg Feb 28, 2026
fc6915d
chore: remove unused id from steps
zimeg Feb 28, 2026
6f7dc50
test: app and token request
zimeg Feb 28, 2026
ddae541
ci: use manifest of the project
zimeg Feb 28, 2026
4a0cf78
ci: gather app id from variables
zimeg Feb 28, 2026
d8247ad
test: echo app settings
zimeg Feb 28, 2026
3698dd9
feat: debug: verbose
zimeg Feb 28, 2026
8a37599
test: confirm action outputs
zimeg Feb 28, 2026
86c95e5
revert: return ids of outputs
zimeg Feb 28, 2026
809cf5c
ci: confirm unknown commands error
zimeg Feb 28, 2026
c73fa17
style: remove repeated outputs of a failed process
zimeg Feb 28, 2026
069243d
chore: merge w main
zimeg Feb 28, 2026
5d9cb89
docs: example
zimeg Feb 28, 2026
ae9124d
docs: redirect
zimeg Feb 28, 2026
4aab456
docs: versions
zimeg Feb 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/resources/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
export SLACK_BOT_TOKEN=xoxb-01010101-example
export SLACK_CHANNEL_ID=C0123456789
export SLACK_INCOMING_WEBHOOK=https://hooks.slack.com/services/T0123456789/B0123456789/abcdefghijklmnopqrstuvwxyz
export SLACK_SERVICE_TOKEN=xoxp-01010101-example
export SLACK_WEBHOOK_TRIGGER=https://hooks.slack.com/triggers/T0123456789/00000000000/abcdefghijklmnopqrstuvwxyz
4 changes: 3 additions & 1 deletion .github/resources/.slack/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"experiments": ["bolt"],
"manifest": {
"source": "local"
},
"project_id": "c4805b41-d1ce-4ea0-b297-ed2f8c64c267"
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"runtime": "actions",
"hooks": {
"deploy": "open https://api.slack.com/apps || true",
"deploy": "echo https://api.slack.com/apps",
"get-manifest": "cat ./.slack/manifest.json #"
},
"config": {
Expand Down
10 changes: 9 additions & 1 deletion .github/resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ experiments with the [Slack CLI][cli].

## Overview

This app showcases all three techniques of sending data into Slack and follows
This app showcases all four techniques of sending data into Slack and follows
patterns found in the integration tests.

- **Technique 1** Slack Workflow Builder: Use a Slack webhook trigger to start a
Expand All @@ -15,13 +15,18 @@ patterns found in the integration tests.
data provided through the GitHub workflow.
- **Technique 3** Incoming webhook: Post a message to a Slack channel using an
incoming webhook.
- **Technique 4** Slack CLI Command: Install and run Slack CLI commands such as
`deploy` or `manifest` using a service token.

Configurations for the Slack app and workflow, and the GitHub Actions workflow
are found in the following files:

- Slack app setup: [`.github/resources/.slack/manifest.json`][slacktion]
- GitHub Actions steps: [`.github/workflows/develop.yml`][develop]

> **Note:** During CLI integration tests, `.github/resources/.slack` is moved to
> `.slack` at the project root so the Slack CLI can discover the app manifest.

Either the techniques or app setup and workflow steps can be adjusted during
testing and development. For experimenting with new changes, we recommend using
the [steps for development](#experimenting-for-development) while the
Expand Down Expand Up @@ -76,6 +81,8 @@ tested. Required values include:
https://hooks.slack.com/services/T0123456789/B0123456789/abcdefghijklmnopqrstuvwxyz
- `SLACK_WEBHOOK_TRIGGER`:
https://hooks.slack.com/triggers/T0123456789/00000000000/abcdefghijklmnopqrstuvwxyz
- `SLACK_SERVICE_TOKEN`: xoxp-service-token-example (secret — for CLI commands)
- `SLACK_APP_ID`: A0123456789 (variable — used with `--app` flag in CLI deploy)

### Experimenting for development

Expand All @@ -98,6 +105,7 @@ export SLACK_BOT_TOKEN=xoxb-01010101-example
export SLACK_CHANNEL_ID=C0123456789
export SLACK_INCOMING_WEBHOOK=https://hooks.slack.com/services/T0123456789/B0123456789/abcdefghijklmnopqrstuvwxyz
export SLACK_WEBHOOK_TRIGGER=https://hooks.slack.com/triggers/T0123456789/00000000000/abcdefghijklmnopqrstuvwxyz
export SLACK_SERVICE_TOKEN=xoxp-service-token-example
```

Environment variables and credentials should be set in the created `.env` file
Expand Down
118 changes: 92 additions & 26 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
integration:
name: Run integration tests
name: Run API tests
runs-on: ubuntu-latest
environment: staging
permissions:
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
env:
INPUT_REF: ${{ inputs.ref }}

- name: "integration(wfb): send a payload to workflow builder via webhook trigger"
- name: "test(wfb): send a payload to workflow builder via webhook trigger"
id: wfb
uses: ./
with:
Expand All @@ -82,12 +82,12 @@ jobs:
repo_name: ${{ github.event.repository.full_name }}
status: ${{ job.status }}

- name: "integration(wfb): confirm a payload was sent"
- name: "test(wfb): confirm a payload was sent"
run: test -n "$WFB_OUTPUT_TIME"
env:
WFB_OUTPUT_TIME: ${{ steps.wfb.outputs.time }}

- name: "integration(botToken): post a message to channel"
- name: "test(api): post a message to channel"
id: message
uses: ./
with:
Expand All @@ -98,12 +98,12 @@ jobs:
channel: ${{ secrets.SLACK_CHANNEL_ID }}
text: ":checkered_flag: Action happens at <https://github.com/${{ github.repository }}>"

- name: "integration(method): confirm a message was posted"
- name: "test(api): confirm a message was posted"
run: test -n "$MESSAGE_OUTPUT_TS"
env:
MESSAGE_OUTPUT_TS: ${{ steps.message.outputs.ts }}

- name: "integration(method): post a message with blocks"
- name: "test(api): post a message with blocks"
id: blocks
uses: ./
with:
Expand All @@ -120,12 +120,12 @@ jobs:
short: true
value: "Processing"

- name: "integration(method): confirm the blocks were posted"
- name: "test(api): confirm the blocks were posted"
run: test -n "$BLOCKS_OUTPUT_TS"
env:
BLOCKS_OUTPUT_TS: ${{ steps.blocks.outputs.ts }}

- name: "integration(method): post a threaded message"
- name: "test(api): post a threaded message"
id: timer
uses: ./
with:
Expand All @@ -137,15 +137,15 @@ jobs:
text: "Started at `${{ steps.blocks.outputs.time }}`"
thread_ts: "${{ steps.blocks.outputs.ts }}"

- name: "integration(incoming): confirm the thread started"
- name: "test(api): confirm the thread started"
run: test -n "$TIMER_OUTPUT_TIME"
env:
TIMER_OUTPUT_TIME: ${{ steps.timer.outputs.time }}

- name: "integration(method): wait to mock event processing"
- name: "test(api): wait to mock event processing"
run: sleep 3

- name: "integration(method): update the original message"
- name: "test(api): update the original message"
id: finished
uses: ./
with:
Expand All @@ -163,7 +163,7 @@ jobs:
short: true
value: "Completed"

- name: "integration(method): post another threaded message"
- name: "test(api): post another threaded message"
id: done
uses: ./
with:
Expand All @@ -175,7 +175,7 @@ jobs:
text: "Finished at `${{ steps.finished.outputs.time }}`"
thread_ts: "${{ steps.timer.outputs.thread_ts }}"

- name: "integration(method): post a file into a channel"
- name: "test(api): post a file into a channel"
id: file
uses: ./
with:
Expand All @@ -188,7 +188,7 @@ jobs:
file: .github/workflows/integration.yml
filename: integration.yml

- name: "integration(method): react to the completed update message"
- name: "test(api): react to the completed update message"
uses: ./
with:
errors: true
Expand All @@ -199,12 +199,12 @@ jobs:
timestamp: ${{ steps.blocks.outputs.ts }}
name: "tada"

- name: "integration(method): confirm the thread ended"
- name: "test(api): confirm the thread ended"
run: test -n "$DONE_OUTPUT_TIME"
env:
DONE_OUTPUT_TIME: ${{ steps.done.outputs.time }}

- name: "integration(incoming): post a message via incoming webhook"
- name: "test(incoming): post a message via incoming webhook"
id: incoming
uses: ./
with:
Expand All @@ -220,17 +220,17 @@ jobs:
text: ":link: A message was received via incoming webhook"
emoji: true

- name: "integration(incoming): confirm a webhook was posted"
- name: "test(incoming): confirm a webhook was posted"
run: test -n "$INCOMING_WEBHOOK_OUTPUT_TIME"
env:
INCOMING_WEBHOOK_OUTPUT_TIME: ${{ steps.incoming.outputs.time }}

- name: "integration(incoming): reveal contents of the github payload"
- name: "test(incoming): reveal contents of the github payload"
run: echo "$JSON"
env:
JSON: ${{ toJSON(github) }}

- name: "integration(incoming): post a message via payload file"
- name: "test(incoming): post a message via payload file"
id: payload_file
uses: ./
with:
Expand All @@ -243,15 +243,81 @@ jobs:
JOB_STATUS: ${{ job.status }}
ATTACHMENT_COLOR: ${{ (job.status == 'success' && 'good') || (job.status == 'failure' && 'danger') || 'warning' }}

- name: "integration(incoming): confirm a payload file was posted"
- name: "test(incoming): confirm a payload file was posted"
run: test -n "$PAYLOAD_FILE_OUTPUT_TIME"
env:
PAYLOAD_FILE_OUTPUT_TIME: ${{ steps.payload_file.outputs.time }}

- name: "chore(health): check up on recent changes to the health score"
uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1
cli:
name: Run CLI tests
runs-on: ${{ matrix.os }}
environment: staging
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
Comment on lines +259 to +261
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 💯

permissions:
contents: read
steps:
- name: "build: checkout the latest changes"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
ref: ${{ inputs.ref || github.event.pull_request.head.sha || github.sha }}

- name: "test(cli): run a slack cli version check"
id: version
uses: ./cli
with:
command: "version"
version: "3.14.0"

- name: "test(cli): confirm the version check outputs"
shell: bash
run: |
set -ex
[ "$CLI_OK" = "true" ]
echo "$CLI_TIME" | grep -qE '^[0-9]+$'
[ -n "$CLI_RESPONSE" ]
env:
CLI_OK: ${{ steps.version.outputs.ok }}
CLI_RESPONSE: ${{ steps.version.outputs.response }}
CLI_TIME: ${{ steps.version.outputs.time }}

- name: "test(cli): run an unknown command"
id: unknown
continue-on-error: true
uses: ./cli
with:
command: "off"

- name: "test(cli): confirm the unknown command outputs"
shell: bash
run: |
set -ex
[ "$CLI_OK" = "false" ]
echo "$CLI_TIME" | grep -qE '^[0-9]+$'
[ -n "$CLI_RESPONSE" ]
env:
CLI_OK: ${{ steps.unknown.outputs.ok }}
CLI_RESPONSE: ${{ steps.unknown.outputs.response }}
CLI_TIME: ${{ steps.unknown.outputs.time }}

- name: "chore: configure the actioneering application"
shell: bash
run: mv .github/resources/.slack .slack

- name: "test(cli): validate the app manifest"
uses: ./cli
with:
command: "manifest"
token: ${{ secrets.SLACK_SERVICE_TOKEN }}

- name: "test(cli): deploy the app"
uses: ./cli
with:
codecov_token: ${{ secrets.CODECOV_API_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
extension: js
include: src
command: "deploy --app ${{ vars.SLACK_APP_ID }} --hide-triggers --force"
token: ${{ secrets.SLACK_SERVICE_TOKEN }}
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
uses: teunmooij/github-versioned-release@3edf649c6e5e5e976d43f2584b15bdc8b4c8f0df # v1.2.1
with:
template: javascript-action
include: |
dist/**/*
cli/**/*
env:
GITHUB_TOKEN: ${{ github.token }}

Expand Down
Loading
Loading