From 846824ee3900356896e29a72ac481d066e4835a5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Feb 2026 04:25:36 +0000 Subject: [PATCH] Add HEX_API_KEY validation to publish workflow The publish step was failing with "No write key found for user" because the HEX_API_KEY secret is not configured. Add an early check that fails fast with a clear error message directing the user to set the secret in repository settings. https://claude.ai/code/session_01SofRCtGSqFNGaLWzzB8GeK --- .github/workflows/publish.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 734e441..4574603 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,15 +60,23 @@ jobs: key: ${{ runner.os }}-otp-27-build-${{ hashFiles('rebar.config') }} restore-keys: ${{ runner.os }}-otp-27-build- + - name: Check HEX_API_KEY + run: | + if [ -z "$HEX_API_KEY" ]; then + echo "::error::HEX_API_KEY secret is not set. Go to repo Settings > Secrets and variables > Actions and add a HEX_API_KEY secret with a valid hex.pm write key." + exit 1 + fi + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + - name: Publish to Hex.pm run: rebar3 hex publish --yes env: HEX_API_KEY: ${{ secrets.HEX_API_KEY }} - - name: Generate docs - run: rebar3 ex_doc - - - name: Publish docs - run: rebar3 hex docs publish --yes + - name: Generate and publish docs + run: | + rebar3 ex_doc + rebar3 hex docs publish --yes env: HEX_API_KEY: ${{ secrets.HEX_API_KEY }}