From 80f7206821a5c227f3b8db446f4c5bb1ac209cf6 Mon Sep 17 00:00:00 2001 From: Blaine Motsinger Date: Fri, 13 Nov 2026 09:58:39 -0500 Subject: [PATCH 1/2] GH-103: run CI on GitHub-hosted runners A public repository cannot use actions or reusable workflows hosted in a private repository, so vendor slack-notify and pr-events instead of reaching into renderorange/.github. Every job moves to ubuntu-latest; nothing here needed the self-hosted box. --- .github/actions/slack-notify/action.yml | 78 +++++++++++++++++++++++++ .github/actions/slack-notify/run.sh | 74 +++++++++++++++++++++++ .github/workflows/ci.yml | 12 ++-- .github/workflows/pr-events.yml | 32 ++++++++++ .github/workflows/release.yml | 14 ++--- .github/workflows/slack-pr-events.yml | 6 +- 6 files changed, 200 insertions(+), 16 deletions(-) create mode 100644 .github/actions/slack-notify/action.yml create mode 100644 .github/actions/slack-notify/run.sh create mode 100644 .github/workflows/pr-events.yml diff --git a/.github/actions/slack-notify/action.yml b/.github/actions/slack-notify/action.yml new file mode 100644 index 0000000..2d66929 --- /dev/null +++ b/.github/actions/slack-notify/action.yml @@ -0,0 +1,78 @@ +# Vendored from renderorange/.github:.github/actions/slack-notify +# Required because chute is a public repository and a public repository cannot +# consume actions from a private one. Keep this byte-identical to the source +# except for this header, and update the source first. +name: slack-notify +description: Post a pipeline or develop message to Slack via incoming webhook +inputs: + template: + description: message shape - job | review | pr-event + required: true + status: + description: pr-event status word - opened | merged | closed | assigned + required: false + default: "" + job: + description: job or workflow name for job/review templates + required: false + default: "" + conclusion: + description: job.status at end - success | failure | cancelled + required: false + default: success + summary: + description: optional suffix, e.g. findings count + required: false + default: "" + repo: + description: full name owner/name + required: false + default: "" + run-id: + description: github.run_id + required: false + default: "" + pr-number: + description: github.event.pull_request.number + required: false + default: "" + pr-title: + description: github.event.pull_request.title + required: false + default: "" + author: + description: PR author login + required: false + default: "" + sha: + description: full commit sha; defaults to GITHUB_SHA (7-char preview in message) + required: false + default: "" + branch: + description: branch name; defaults to GITHUB_HEAD_REF then GITHUB_REF_NAME + required: false + default: "" + dry-run: + description: print payload instead of posting + required: false + default: "false" +runs: + using: composite + steps: + - name: Post to Slack + shell: bash + env: + IN_TEMPLATE: ${{ inputs.template }} + IN_STATUS: ${{ inputs.status }} + IN_JOB: ${{ inputs.job }} + IN_CONCLUSION: ${{ inputs.conclusion }} + IN_SUMMARY: ${{ inputs.summary }} + IN_REPO: ${{ inputs.repo }} + IN_RUN_ID: ${{ inputs.run-id }} + IN_PR_NUMBER: ${{ inputs.pr-number }} + IN_PR_TITLE: ${{ inputs.pr-title }} + IN_AUTHOR: ${{ inputs.author }} + IN_SHA: ${{ inputs.sha }} + IN_BRANCH: ${{ inputs.branch }} + IN_DRY_RUN: ${{ inputs.dry-run }} + run: bash "${{ github.action_path }}/run.sh" \ No newline at end of file diff --git a/.github/actions/slack-notify/run.sh b/.github/actions/slack-notify/run.sh new file mode 100644 index 0000000..f22f3f1 --- /dev/null +++ b/.github/actions/slack-notify/run.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +# Vendored from renderorange/.github:.github/actions/slack-notify/run.sh +# Public repositories cannot use actions from private repositories, so chute +# carries its own copy. Keep it identical to the source and update there first. +set -euo pipefail + +if [ -z "${SLACK_WEBHOOK_URL:-}" ]; then + echo "::error::SLACK_WEBHOOK_URL is empty; caller job must set it from a secret" + exit 1 +fi + +text="" +repo="${IN_REPO:-${GITHUB_REPOSITORY:-}}" +if [ -z "$repo" ]; then + echo "::error::repo is empty; caller must pass repo or GITHUB_REPOSITORY must be set" + exit 1 +fi +branch="${IN_BRANCH:-${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-}}}" +sha_raw="${IN_SHA:-${GITHUB_SHA:-}}" +short_sha="${sha_raw:0:7}" +[ -n "$short_sha" ] || short_sha="unknown" +case "$IN_TEMPLATE" in + pr-event) + pr_url="https://github.com/${repo}/pull/${IN_PR_NUMBER}" + head="[${repo}] PR #${IN_PR_NUMBER} ${IN_STATUS} · ${IN_PR_TITLE} by ${IN_AUTHOR}" + text=$(jq -n \ + --arg h "$head" --arg b "$branch" --arg c "$short_sha" --arg u "$pr_url" \ + 'if $b != "" and $c != "unknown" then [$h, ("branch: " + $b), ("commit: " + $c), $u] else [$h, $u] end | join("\n")') + ;; + review) + run_url="https://github.com/${repo}/actions/runs/${IN_RUN_ID}" + verdict="failed" + [ "$IN_CONCLUSION" = "success" ] && verdict="succeeded" + head="[${repo}] review ${verdict}" + if [ "$IN_CONCLUSION" = "success" ] && [ -n "$IN_SUMMARY" ]; then + head="${head} · ${IN_SUMMARY}" + fi + text=$(jq -n --arg h "$head" --arg c "$short_sha" --arg b "$branch" --arg u "$run_url" \ + 'if $b != "" then [$h, ("branch: " + $b), ("commit: " + $c), $u] else [$h, ("commit: " + $c), $u] end | join("\n")') + ;; + job) + run_url="https://github.com/${repo}/actions/runs/${IN_RUN_ID}" + verdict=$(printf '%s' "$IN_CONCLUSION" | tr '[:upper:]' '[:lower:]') + case "$IN_CONCLUSION" in + success) verdict="succeeded" ;; + failure) verdict="failed" ;; + cancelled) verdict="cancelled" ;; + timed_out) verdict="timed out" ;; + esac + head="[${repo}] ${IN_JOB} ${verdict}" + [ -n "$IN_SUMMARY" ] && head="${head} · ${IN_SUMMARY}" + text=$(jq -n --arg h "$head" --arg c "$short_sha" --arg b "$branch" --arg u "$run_url" \ + 'if $b != "" then [$h, ("branch: " + $b), ("commit: " + $c), $u] else [$h, ("commit: " + $c), $u] end | join("\n")') + ;; + *) + echo "::error::unknown template '${IN_TEMPLATE}'" + exit 1 + ;; +esac + +if [ "$IN_DRY_RUN" = "true" ]; then + echo "DRY_RUN payload: $text" + exit 0 +fi + +resp=$(curl -sS -o /tmp/slack_response.$$ -w '%{http_code}' -X POST \ + -H 'Content-type: application/json' \ + --data "{\"text\": $text}" "$SLACK_WEBHOOK_URL") +rm -f /tmp/slack_response.$$ +if ! echo "$resp" | grep -q '^200$'; then + echo "::error::slack webhook returned HTTP $resp" + exit 1 +fi +echo "slack notified: $IN_TEMPLATE" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e6b6c3..5cffb6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ concurrency: jobs: test: name: Test - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -41,7 +41,7 @@ jobs: - name: Notify Slack if: always() - uses: renderorange/.github/.github/actions/slack-notify@main + uses: ./.github/actions/slack-notify env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PIPELINE_WEBHOOK_URL }} with: @@ -54,7 +54,7 @@ jobs: lint: name: Lint - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -72,7 +72,7 @@ jobs: - name: Notify Slack if: always() - uses: renderorange/.github/.github/actions/slack-notify@main + uses: ./.github/actions/slack-notify env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PIPELINE_WEBHOOK_URL }} with: @@ -85,7 +85,7 @@ jobs: build: name: Build - runs-on: self-hosted + runs-on: ubuntu-latest needs: test steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -112,7 +112,7 @@ jobs: - name: Notify Slack if: always() - uses: renderorange/.github/.github/actions/slack-notify@main + uses: ./.github/actions/slack-notify env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PIPELINE_WEBHOOK_URL }} with: diff --git a/.github/workflows/pr-events.yml b/.github/workflows/pr-events.yml new file mode 100644 index 0000000..c1139fc --- /dev/null +++ b/.github/workflows/pr-events.yml @@ -0,0 +1,32 @@ +# Vendored from renderorange/.github:.github/workflows/pr-events.yml +# Public repositories cannot call reusable workflows in private repositories, so +# chute carries its own copy and calls it as a local workflow. Runs on a +# GitHub-hosted runner: the message needs nothing from the self-hosted box. +name: pr-events + +on: + workflow_call: + secrets: + SLACK_DEVELOPMENT_WEBHOOK_URL: + required: false + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Post PR event to develop channel + uses: ./.github/actions/slack-notify + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEVELOPMENT_WEBHOOK_URL }} + with: + template: pr-event + status: >- + ${{ + github.event.action == 'closed' && + (github.event.pull_request.merged && 'merged' || 'closed') || + github.event.action + }} + repo: ${{ github.repository }} + pr-number: ${{ github.event.pull_request.number }} + pr-title: ${{ github.event.pull_request.title }} + author: ${{ github.event.pull_request.user.login }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b34364c..d9a4d5c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ concurrency: jobs: test: name: Test - runs-on: self-hosted + runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -41,7 +41,7 @@ jobs: - name: Notify Slack if: always() - uses: renderorange/.github/.github/actions/slack-notify@main + uses: ./.github/actions/slack-notify env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PIPELINE_WEBHOOK_URL }} with: @@ -54,7 +54,7 @@ jobs: # differ by seconds and the four binaries of one release must share a tag. version: name: Version - runs-on: self-hosted + runs-on: ubuntu-latest outputs: version: ${{ steps.version.outputs.version }} steps: @@ -64,7 +64,7 @@ jobs: build: name: Build ${{ matrix.goos }}-${{ matrix.goarch }} - runs-on: self-hosted + runs-on: ubuntu-latest needs: [test, version] strategy: fail-fast: false @@ -116,7 +116,7 @@ jobs: - name: Notify Slack if: always() - uses: renderorange/.github/.github/actions/slack-notify@main + uses: ./.github/actions/slack-notify env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PIPELINE_WEBHOOK_URL }} with: @@ -127,7 +127,7 @@ jobs: release: name: Release - runs-on: self-hosted + runs-on: ubuntu-latest needs: [version, build] permissions: contents: write @@ -154,7 +154,7 @@ jobs: - name: Notify Slack if: always() - uses: renderorange/.github/.github/actions/slack-notify@main + uses: ./.github/actions/slack-notify env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PIPELINE_WEBHOOK_URL }} with: diff --git a/.github/workflows/slack-pr-events.yml b/.github/workflows/slack-pr-events.yml index 6ff42af..8afd280 100644 --- a/.github/workflows/slack-pr-events.yml +++ b/.github/workflows/slack-pr-events.yml @@ -1,13 +1,13 @@ name: slack-pr-events # Posts PR lifecycle events (opened / merged / closed / assigned) to the develop -# channel. The message shape and the webhook live in renderorange/.github; this -# file is the thin caller documented in that repo's README. +# channel. The workflow and the action are vendored into this repo because chute +# is public and cannot use them from the private renderorange/.github. on: pull_request: types: [opened, closed, assigned] jobs: notify: - uses: renderorange/.github/.github/workflows/pr-events.yml@main + uses: ./.github/workflows/pr-events.yml secrets: inherit From e19451c27abd8cc18321b44dbe8a658ef68ad089 Mon Sep 17 00:00:00 2001 From: Blaine Motsinger Date: Fri, 13 Nov 2026 09:59:12 -0500 Subject: [PATCH 2/2] GH-103: checkout before the local action A reusable workflow gets no checkout of its own, so the vendored composite action could not be resolved. Found by the first run of the new workflow. --- .github/workflows/pr-events.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-events.yml b/.github/workflows/pr-events.yml index c1139fc..9fb3c4d 100644 --- a/.github/workflows/pr-events.yml +++ b/.github/workflows/pr-events.yml @@ -14,6 +14,10 @@ jobs: notify: runs-on: ubuntu-latest steps: + # A reusable workflow gets no checkout of its own, and a local action + # cannot be resolved without one. + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Post PR event to develop channel uses: ./.github/actions/slack-notify env: