feat: env-diff, verify-deploy and notify actions #6

Merged
robin.wieske merged 1 commit from feat/env-verify-notify into main 2026-11-10 23:03:13 +01:00
Owner

Closes #3.

Summary

Three composite actions (runs: using: composite, bash + curl + jq + git only). Each action.yml is a thin wrapper: inputs reach the scripts only through env:, never through ${{ }} inside run:.

env-diff/

  • env-diff.sh and lib/dotenv.awk are Aevana's .bin/env-diff.sh / .bin/lib/dotenv.awk. Only the comments changed, so the git-ref mode, --files, --baseline-file and ENV_DIFF_PATH all work as before.
  • report.sh holds the release body step from publish_release.yaml:
    • The previous tag is the newest strict vX.Y.Z other than tag, or the previous_tag input.
    • The section goes between <!-- env-changes:start/end -->. A rerun replaces it, and content outside the markers is kept.
  • Outputs:
    • new_keys: JSON array computed with dotenv.awk, not parsed from the Markdown. It is written as [] first, so it is always valid JSON.
    • report (multiline).
    • previous_tag.
  • Never fails unless fail_on_error: true; otherwise it logs a ::warning::.
  • Warns on a shallow clone. Requires fetch-depth: 0, documented in its README.
  • With no release_id, it only computes the outputs.

verify-deploy/

  • Aevana's verify-deploy.sh plus these inputs:
    • /version as plain text or {"version": "..."} JSON.
    • mode: contains with a configurable path, for the legacy homepage grep.
    • user_agent, default laravel-deploy-verify/1.
    • max_time.
    • diagnose.
    • Optional extra_url, with its own path, attempts and delay (kima/portal's license host).
  • Unchanged from Aevana:
    • Exit codes 0/1/2.
    • URL and host masking.
    • Set-Cookie values omitted.

notify/

  • Builds the plan's schema 1 payload with jq:
    • The link input is sent as url.
    • ts is UTC ISO.
    • dedup_key defaults to <project>:<event>:<version>.
  • Validation:
    • event must be one of the 7 plan events.
    • severity must be info, warn or critical.
    • reasons must be a JSON array.
  • Delivery means HTTP 2xx.
  • Tokens are written to curl header files, so they never appear on argv or in the log.
  • Not required: always exits 0, with a warning when the url is empty, an input is invalid, the answer is non-2xx or n8n is down.
  • required: "true":
    • The step fails when the event is not delivered.
    • On delivery it does POST /repos/{repo}/statuses/{sha} with <status_context> (default notify/pre-prod) = success.
    • A failed status update also fails the step.

Differences vs the Aevana / kima/portal / slight-exposure copies

  • Aevana and kima/portal have the same script logic. Portal differs only in comments and in the user agent kima-portal-deploy-verify/1, which is now the user_agent input. slight-exposure has env-diff.sh but no verify-deploy.sh; its deploy workflows grep the homepage, which is what mode: contains with path: / covers.
  • The env step of publish_release.yaml is the same in all three, except for the closing check-env hint. Aevana and portal append it and slight-exposure does not, so it is now the footer input (default empty).
  • verify-deploy now requires jq, for the JSON /version form, and checks for curl and jq up front (exit 2).
  • The diagnose mode probes / and the configured path instead of a fixed /version.
  • Portal's license-host check (VERIFY_ATTEMPTS=10, VERIFY_DELAY=10) maps to extra_url with extra_attempts and extra_delay.

Tests

  • tests/run.sh runs plain bash tests (bats is not available locally), using a python3 stdlib stub server (tests/stub_server.py) that logs every request:
    • env-diff: golden outputs generated with Aevana's original script (new, changed and removed keys, changed comments, "No environment changes.", from and to an empty file, baseline mode). A temporary git repo with tags covers previous-tag selection, new_keys, release body patching, idempotency (second run gives the same body), the footer, warning vs fail_on_error, and the API being down.
    • verify-deploy: plain text and JSON, retries, never matched (exit 1), redirects, Set-Cookie omitted, contains mode, user agent, diagnose, server down, and usage errors (exit 2). It also asserts the host never appears in the output.
    • notify: the exact payload and key order, the header token, the 7 events, invalid inputs, an empty url, HTTP 500 and n8n down (never fail), and required mode (fails, status payload and token, custom context). It also asserts the tokens are never logged.
  • shellcheck is clean on all scripts.
  • CI is .github/workflows/test_shell_actions.yaml:
    • Container image node:24-bookworm-slim@sha256:01d5…; node is needed because actions/checkout v7 is a node24 action. The job runs apt-get install for git, jq, curl, python3 and shellcheck.
    • Steps: shellcheck, the tests, then smoke runs of ./notify, ./env-diff and ./verify-deploy through uses: to exercise the action.yml wiring.
  • Run locally on macOS (bash 3.2) and in the same container image: 118 checks pass.

Not verified

  • Cross-repo composite uses: https://forgejo.entwirr.me/Wi3eDigital/laravel-deploy-actions/<dir>@<sha> on Forgejo, including github.action_path resolving to the action directory. To be verified in the Aevana pilot. CI only covers local uses: ./<dir>.
  • Whether Forgejo keeps the last value when GITHUB_OUTPUT sets the same name twice. notify writes delivered=false first, then true, and env-diff does the same with new_keys; GitHub keeps the last one.
  • The n8n "Deploy notify" workflow does not exist yet, so the real webhook's answer codes are untested.

🤖 Generated with Claude Code

https://claude.ai/code/session_0114prpbjyD3Bqt26YpZ1MEL

Closes #3. ## Summary Three composite actions (`runs: using: composite`, bash + curl + jq + git only). Each `action.yml` is a thin wrapper: inputs reach the scripts only through `env:`, never through `${{ }}` inside `run:`. ### `env-diff/` - `env-diff.sh` and `lib/dotenv.awk` are Aevana's `.bin/env-diff.sh` / `.bin/lib/dotenv.awk`. Only the comments changed, so the git-ref mode, `--files`, `--baseline-file` and `ENV_DIFF_PATH` all work as before. - `report.sh` holds the release body step from `publish_release.yaml`: - The previous tag is the newest strict `vX.Y.Z` other than `tag`, or the `previous_tag` input. - The section goes between `<!-- env-changes:start/end -->`. A rerun replaces it, and content outside the markers is kept. - Outputs: - `new_keys`: JSON array computed with `dotenv.awk`, not parsed from the Markdown. It is written as `[]` first, so it is always valid JSON. - `report` (multiline). - `previous_tag`. - Never fails unless `fail_on_error: true`; otherwise it logs a `::warning::`. - Warns on a shallow clone. Requires `fetch-depth: 0`, documented in its README. - With no `release_id`, it only computes the outputs. ### `verify-deploy/` - Aevana's `verify-deploy.sh` plus these inputs: - `/version` as plain text or `{"version": "..."}` JSON. - `mode: contains` with a configurable `path`, for the legacy homepage grep. - `user_agent`, default `laravel-deploy-verify/1`. - `max_time`. - `diagnose`. - Optional `extra_url`, with its own path, attempts and delay (kima/portal's license host). - Unchanged from Aevana: - Exit codes 0/1/2. - URL and host masking. - `Set-Cookie` values omitted. ### `notify/` - Builds the plan's schema 1 payload with `jq`: - The `link` input is sent as `url`. - `ts` is UTC ISO. - `dedup_key` defaults to `<project>:<event>:<version>`. - Validation: - `event` must be one of the 7 plan events. - `severity` must be info, warn or critical. - `reasons` must be a JSON array. - Delivery means HTTP 2xx. - Tokens are written to curl header files, so they never appear on argv or in the log. - Not required: always exits 0, with a warning when the url is empty, an input is invalid, the answer is non-2xx or n8n is down. - `required: "true"`: - The step fails when the event is not delivered. - On delivery it does `POST /repos/{repo}/statuses/{sha}` with `<status_context>` (default `notify/pre-prod`) = success. - A failed status update also fails the step. ## Differences vs the Aevana / kima/portal / slight-exposure copies - Aevana and kima/portal have the same script logic. Portal differs only in comments and in the user agent `kima-portal-deploy-verify/1`, which is now the `user_agent` input. slight-exposure has `env-diff.sh` but no `verify-deploy.sh`; its deploy workflows grep the homepage, which is what `mode: contains` with `path: /` covers. - The env step of `publish_release.yaml` is the same in all three, except for the closing check-env hint. Aevana and portal append it and slight-exposure does not, so it is now the `footer` input (default empty). - verify-deploy now requires `jq`, for the JSON `/version` form, and checks for `curl` and `jq` up front (exit 2). - The diagnose mode probes `/` and the configured `path` instead of a fixed `/version`. - Portal's license-host check (`VERIFY_ATTEMPTS=10`, `VERIFY_DELAY=10`) maps to `extra_url` with `extra_attempts` and `extra_delay`. ## Tests - `tests/run.sh` runs plain bash tests (bats is not available locally), using a python3 stdlib stub server (`tests/stub_server.py`) that logs every request: - **env-diff:** golden outputs generated with Aevana's original script (new, changed and removed keys, changed comments, "No environment changes.", from and to an empty file, baseline mode). A temporary git repo with tags covers previous-tag selection, `new_keys`, release body patching, idempotency (second run gives the same body), the footer, warning vs `fail_on_error`, and the API being down. - **verify-deploy:** plain text and JSON, retries, never matched (exit 1), redirects, `Set-Cookie` omitted, contains mode, user agent, diagnose, server down, and usage errors (exit 2). It also asserts the host never appears in the output. - **notify:** the exact payload and key order, the header token, the 7 events, invalid inputs, an empty url, HTTP 500 and n8n down (never fail), and required mode (fails, status payload and token, custom context). It also asserts the tokens are never logged. - shellcheck is clean on all scripts. - CI is `.github/workflows/test_shell_actions.yaml`: - Container image `node:24-bookworm-slim@sha256:01d5…`; node is needed because actions/checkout v7 is a node24 action. The job runs `apt-get install` for git, jq, curl, python3 and shellcheck. - Steps: shellcheck, the tests, then smoke runs of `./notify`, `./env-diff` and `./verify-deploy` through `uses:` to exercise the `action.yml` wiring. - Run locally on macOS (bash 3.2) and in the same container image: 118 checks pass. ## Not verified - Cross-repo composite `uses: https://forgejo.entwirr.me/Wi3eDigital/laravel-deploy-actions/<dir>@<sha>` on Forgejo, including `github.action_path` resolving to the action directory. To be verified in the Aevana pilot. CI only covers local `uses: ./<dir>`. - Whether Forgejo keeps the last value when `GITHUB_OUTPUT` sets the same name twice. `notify` writes `delivered=false` first, then `true`, and env-diff does the same with `new_keys`; GitHub keeps the last one. - The n8n "Deploy notify" workflow does not exist yet, so the real webhook's answer codes are untested. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0114prpbjyD3Bqt26YpZ1MEL
feat: env-diff, verify-deploy and notify actions
All checks were successful
Test shell actions / test (pull_request) Successful in 1m26s
74f161414c
Composite actions ported from Aevana's .bin/env-diff.sh, .bin/lib/dotenv.awk
and .bin/verify-deploy.sh, plus notify for the n8n Deploy notify webhook.
Plain bash tests with a python3 stub server, shellcheck in CI.

Closes #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0114prpbjyD3Bqt26YpZ1MEL
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Wi3eDigital/laravel-deploy-actions!6
No description provided.