A GitHub Action that posts Slack notifications with links to GitHub Actions workflow logs.
- name: Notify Slack
uses: air-ltd/slackpost@v9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
SLACKURL: ${{ secrets.SLACK_POST_URL }}
RUNNER: ${{ runner.environment }}| Input | Required | Description |
|---|---|---|
SLACKURL |
Yes | Slack incoming webhook URL |
RUNNER |
No | ${{ runner.environment }} (self-hosted vs github-hosted) |
CONTENT |
No | Text to include in the Slack message |
CONTENT_FILE |
No | Path to a file whose contents are included in the Slack message |
TESTMODE |
No | Set to 'true' (case insensitive) to output JSON without posting to Slack |
SUPPRESS_VERSION_WARNING |
No | Set to 'true' to suppress the version update warning |
GITHUB_TOKEN is read from the environment (set via env: on the step). It is not an action input.
The Slack message includes:
- Header - Workflow name, run number, and job name
- Content - Any
CONTENT/CONTENT_FILEtext (supports long messages, automatically split into 3000-char chunks) - Log links - Direct links to raw logs and HTML logs for the job
The action reads the GitHub context (${{ github }}) automatically and queries the API for job details to build log URLs. Special characters (single quotes, backticks) in event payloads are handled safely via env: + printenv in the composite action, avoiding shell interpretation issues.
A built-in version check compares the pinned version against the latest commit on main and emits a ::warning:: annotation if behind. This runs automatically on every invocation.
The test workflow (.github/workflows/test.yml) runs on push to main and manual dispatch. It:
- Tests
CONTENT_FILE,CONTENT, and combined content in TESTMODE - Tests that the version check produces a warning when pinned to an older hash
- Computes pass/fail step counts and posts a summary to Slack (TESTMODE: false)
SLACK_POST_URL- Slack incoming webhook URL (stored in Bitwarden Secrets Manager)BW_ACCESS_TOKEN- Bitwarden Secrets Manager access tokenGITHUB_TOKEN- Standard GitHub token, auto-provided
Releases are tagged (v1, v2, v3, ...). Reference as air-ltd/slackpost@v9.