on: push: branches: - main # Manual trigger so a missed release can be replayed without waiting for # the next push. The job is idempotent: it tags only merged release PRs # that carry the pending label. workflow_dispatch: permissions: contents: write pull-requests: write name: release-please jobs: release-please: runs-on: ubuntu-latest steps: # The reconcile step below runs a file from this repository. The # release-please action clones into its own temp directory and does not # check the workspace out, so without this step the job fails with # "Cannot find module .../scripts/reconcile-release-please.mjs". - uses: actions/checkout@v7 # release-please marks its release PR with `autorelease: pending` and # later finds the merged PR by that label. Gitea's label API resolves # names and *silently ignores unknown ones* (GetLabelIDsInRepoByNames # filters by name in SQL), so on a repository without these labels the # PR is created unlabeled, the release phase finds no merged release PR # and creates no tag - while the run still reports success. That is the # bug this step prevents: make the labels exist first, every run. - name: Ensure release-please labels exist env: GITEA_TOKEN: ${{ secrets.PR_GITEA_TOKEN }} run: | set -eu existing="$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" \ "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/labels?limit=50")" for name in "autorelease: pending" "autorelease: tagged"; do if printf '%s' "$existing" | grep -qF "\"name\":\"${name}\""; then echo "label exists: ${name}" continue fi code="$(curl -sS -o /tmp/label.json -w '%{http_code}' -X POST \ -H "Authorization: token ${GITEA_TOKEN}" \ -H 'Content-Type: application/json' \ -d "{\"name\":\"${name}\",\"color\":\"ededed\",\"description\":\"release-please state\"}" \ "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/labels")" if [ "$code" != "201" ]; then echo "::error::could not create label '${name}' (HTTP ${code})" cat /tmp/label.json exit 1 fi echo "created label: ${name}" done # The label fix above is not retroactive. PR #22 was merged with # `autorelease: pending` but its head branch had already been deleted, # so the action reports `Bad branch name: refs/pull/22/head`, creates no # tag and leaves the label behind. Every later run then aborts with # "There are untagged, merged release PRs outstanding" and never opens a # new release PR - green, no tags. This step reconciles that state before # the action runs: mark a pending PR tagged when its tag already exists, # or recreate the tag when the head branch is gone and release-please # therefore cannot. See scripts/reconcile-release-please.mjs and # OKF_Nuxt/decisions/release-engineering.md. - name: Reconcile stale release-please state env: GITEA_TOKEN: ${{ secrets.PR_GITEA_TOKEN }} run: node scripts/reconcile-release-please.mjs - uses: joaquinjsb/gitea-release-please-action@v4 with: # One well-scoped token for all workflow API work (see # OKF_Nuxt/decisions/snyk-paused-and-secrets-policy.md). The # dedicated RELEASE_PLEASE_TOKEN_CV_SITE_NUXT secret failed with # exit 1: reads worked (createReleases completed) but creating # the release PR threw - the token lacked the write:repository / # write:issue scopes. PR_GITEA_TOKEN has both and is proven by # the AI-review comment posting. token: ${{ secrets.PR_GITEA_TOKEN }} # The PR-creation path (code-suggester) pushes the release branch # with isomorphic-git using these git credentials - NOT the token # input (octokit reads use the token; the final `git push` uses # git-username/git-password). Unset, the push is anonymous and # fails "HTTP Error: 401 Unauthorized" after the branch commit is # already built. Gitea git-over-HTTPS auth: account name + # token as password. git-username: Noel git-password: ${{ secrets.PR_GITEA_TOKEN }} config-file: release-please-config.json manifest-file: .release-please-manifest.json