PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m11s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 4s
PR Check / AI code review (opencode) (pull_request) Successful in 38s
release-please finds merged release PRs by the 'autorelease: pending' label. Gitea resolves label names with GetLabelIDsInRepoByNames, a SQL IN filter that silently drops unknown names, so on a repository without the labels the PR is created unlabeled and every run finds zero merged release PRs: no tag, no release, and the next release PR instead - with a green run each time. That is what happened to #20 and #21. The workflow now ensures both labels exist (idempotent: list, create the missing ones) and gained workflow_dispatch so a missed release can be replayed.
73 lines
3.2 KiB
YAML
73 lines
3.2 KiB
YAML
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:
|
|
# 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
|
|
|
|
- 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
|