diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index ff01de3..01c8f7f 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -3,10 +3,12 @@ name: Upstream # Weekly drift check against the pinned libraries, tracked in one issue: # library updates also need scripts/fetch-libs.sh and a manual review. The # Blizzard Forever UI source is pinned and tracked by the wow-ui-testing -# library; a new client build arrives here as a .wut-version bump. +# library; a newer library release becomes a .wut-version pull request (the +# test suite reviews it). # # Requires the UPSTREAM_TOKEN secret: a fine-grained token for this -# repository with Contents read and Issues read/write. +# repository with Contents, Pull requests and Issues read/write. Pull requests +# opened with it trigger the test suite, unlike GITHUB_TOKEN. on: schedule: - cron: '0 6 * * 1' @@ -63,3 +65,34 @@ jobs: elif [ -n "$issue" ]; then gh issue close "$issue" --comment 'All pinned libraries match upstream again.' fi + - name: Propose the newest wow-ui-testing release + run: | + repository=voshond/wow-ui-testing + pinned="$(grep -v '^[[:space:]]*\(#\|$\)' .wut-version | head -n 1 | awk '{ print $1 }')" + refs="$(git ls-remote --tags "https://github.com/$repository.git")" + tag="$(sed -n 's|.*refs/tags/\(v[0-9]*\.[0-9]*\.[0-9]*\)$|\1|p' <<<"$refs" | sort -V | tail -n 1)" + if [ -z "$tag" ]; then + echo "::error::No release tags in $repository." + exit 1 + fi + latest="$(awk -v ref="refs/tags/$tag^{}" '$2 == ref { print $1 }' <<<"$refs")" + [ -n "$latest" ] || latest="$(awk -v ref="refs/tags/$tag" '$2 == ref { print $1 }' <<<"$refs")" + printf '\n| wow-ui-testing | `%s` | `%s` @ `%s` | %s |\n' "${pinned:0:7}" "$tag" "${latest:0:7}" \ + "$([ "$pinned" = "$latest" ] && echo current || echo behind)" >> "$GITHUB_STEP_SUMMARY" + if [ "$pinned" = "$latest" ]; then exit 0; fi + printf '%s # %s\n' "$latest" "$tag" > .wut-version + branch=upstream/wow-ui-testing + git config user.name 'github-actions[bot]' + git config user.email '41898282+github-actions[bot]@users.noreply.github.com' + git switch -c "$branch" + git add .wut-version + git commit -q -m "Bump wow-ui-testing to $tag" \ + -m "Generated by the Upstream workflow from $repository $latest." + git push -q --force origin "$branch" + if [ -z "$(gh pr list --head "$branch" --state open --json number --jq '.[].number')" ]; then + gh pr create --base main --head "$branch" --title "Bump wow-ui-testing to $tag" --body "## Summary + - Pins \`.wut-version\` to $repository \`$tag\` (\`$latest\`). + - The library's pinned Blizzard client source, API snapshot and atlas table come with it. + + Review the [library changes](https://github.com/$repository/compare/$pinned...$latest) and the spell catalogue check. Install and check the client before merging when the build changes behaviour." + fi