Skip to content

Make the ESPHome GitHub App optional in publish-draft-release - #183

Merged
jesserockz merged 1 commit into
mainfrom
jesserockz-2026-677
Sep 18, 2026
Merged

jesserockz merged 1 commit into
mainfrom
jesserockz-2026-677

Conversation

@jesserockz

Copy link
Copy Markdown
Member

publish-draft-release.yml currently hard-requires the ESPHome GitHub App (vars.ESPHOME_GITHUB_APP_CLIENT_ID / secrets.ESPHOME_GITHUB_APP_PRIVATE_KEY). esphome-project-template is a GitHub template repo that outside people generate into their own accounts, where the App does not exist. The rest of the template's release/build/draft pipeline runs entirely on the default GITHUB_TOKEN; this publish step was the only App dependency. This brings the shared reusable to parity so the template, and any other outside consumer, can eventually just uses: it.

Changes

  • ESPHOME_GITHUB_APP_PRIVATE_KEY secret is now required: false.
  • Job gains permissions: contents: write (was {}), which is what lets the fallback github.token read the draft, replace its *.manifest.json assets and publish it. When the App token is used, github.token simply goes unused.
  • The Generate a token step is gated on if: ${{ vars.ESPHOME_GITHUB_APP_CLIENT_ID != '' }}, so it is skipped when the App is not configured.
  • Every GH_TOKEN now resolves to ${{ steps.generate-token.outputs.token || github.token }}; a skipped step's output is empty, selecting github.token on the fallback path.
  • environment is now an optional input defaulting to release, so org repos keep their protection rules while outside repos can pass an empty string to opt out.
  • The header comment documents the behaviour and the important caveat: a release published with GITHUB_TOKEN does NOT emit a downstream release: published event (GitHub's anti-recursion rule), so consumers that rely on that event must trigger off workflow_run of their Release workflow on the fallback path instead. esphome-project-template does exactly this.

publish-draft-release.yml is not smoke-tested by ci.yml / ci-draft-release.yml (it needs a live draft plus a real publish), so this relies on static checks (yamllint) and review. Existing org callers are unaffected: the new environment input defaults to release and the now-optional secret is still supplied.

Fall back to the default GITHUB_TOKEN when the App is not configured, so
template-generated and other outside consumer repositories can use this
reusable workflow. The App is still used when configured so that
publishing emits a downstream release: published event; the fallback path
publishes with GITHUB_TOKEN, which does not emit that event, so consumers
must trigger off workflow_run instead. Also make the deployment
environment an optional input defaulting to release.
@jesserockz
jesserockz merged commit 1fd490b into main Sep 18, 2026
36 checks passed
@jesserockz
jesserockz deleted the jesserockz-2026-677 branch September 18, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant