Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
luacheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: nebularg/actions-luacheck@v1
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ on:
permissions:
contents: write
pull-requests: write
issues: write

jobs:
release-pr:
uses: DragonAddons/wow-workflows/.github/workflows/release-pr.yml@main
secrets: inherit
runs-on: ubuntu-latest
steps:
- name: Run release-please
id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ github.token }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
71 changes: 67 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,70 @@ permissions:

jobs:
release:
uses: DragonAddons/wow-workflows/.github/workflows/release.yml@main
with:
tag_name: ${{ inputs.tag_name || '' }}
secrets: inherit
name: Package and Upload
runs-on: ubuntu-latest
env:
CF_API_KEY: ${{ secrets.CF_API_KEY }}
WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Resolve tag
shell: bash
run: |
if [[ -n "${{ inputs.tag_name || '' }}" ]]; then
TAG="${{ inputs.tag_name }}"
else
TAG="${{ github.ref_name }}"
fi

echo "TAG_NAME=$TAG" >> "$GITHUB_ENV"

- name: Resolve workflow source ref
id: workflow-source
shell: bash
env:
WORKFLOW_REF: ${{ github.workflow_ref }}
run: |
WORKFLOW_SOURCE_REF="${WORKFLOW_REF##*@}"

if [[ -z "$WORKFLOW_SOURCE_REF" || "$WORKFLOW_SOURCE_REF" == "$WORKFLOW_REF" ]]; then
echo "Unable to parse workflow source ref from: $WORKFLOW_REF" >&2
exit 1
fi

echo "ref=$WORKFLOW_SOURCE_REF" >> "$GITHUB_OUTPUT"

- name: Checkout workflow source
uses: actions/checkout@v6
with:
ref: ${{ steps.workflow-source.outputs.ref }}
fetch-depth: 1
path: .workflow-source

- name: Preserve changelog script
shell: bash
run: |
mkdir -p "$RUNNER_TEMP/release-scripts"
cp .workflow-source/scripts/generate_changelog.sh "$RUNNER_TEMP/release-scripts/generate_changelog.sh"

- name: Checkout tag
uses: actions/checkout@v6
with:
ref: refs/tags/${{ env.TAG_NAME }}
fetch-depth: 0

- name: Restore changelog script
shell: bash
run: |
mkdir -p scripts
cp "$RUNNER_TEMP/release-scripts/generate_changelog.sh" scripts/generate_changelog.sh
chmod +x scripts/generate_changelog.sh

Comment thread
Xerrion marked this conversation as resolved.
- name: Generate changelog
shell: bash
run: bash scripts/generate_changelog.sh

- name: Package and upload
uses: BigWigsMods/packager@v2
env:
GITHUB_REF: refs/tags/${{ env.TAG_NAME }}
72 changes: 69 additions & 3 deletions .github/workflows/toc-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,76 @@ on:

permissions:
contents: write
issues: write
pull-requests: write

jobs:
update:
uses: DragonAddons/wow-workflows/.github/workflows/toc-update.yml@main
with:
flavors: "retail classic vanilla tbc"
name: Update TOC versions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: master
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Ensure TOC update script is executable
shell: bash
run: chmod +x scripts/update_toc_versions.sh

- name: Update TOC versions
shell: bash
env:
FLAVORS: retail classic vanilla tbc
run: |
args=()
for flavor in $FLAVORS; do
args+=(--flavor "$flavor")
done

bash scripts/update_toc_versions.sh "${args[@]}"

- name: Check for changes
id: diff
shell: bash
run: |
if git diff --quiet; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
echo "No TOC changes detected"
exit 0
fi

echo "has_changes=true" >> "$GITHUB_OUTPUT"
echo "TOC changes detected:"
git diff --name-only

- name: Create or update PR
if: steps.diff.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
BRANCH="chore/toc-interface-version"
TITLE="chore: update TOC Interface versions"

git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

git checkout -B "$BRANCH"
git add -A
git commit -m "$TITLE"
git push --force-with-lease origin "$BRANCH"

gh label create "automated" --description "Auto-generated changes" --color "ededed" 2>/dev/null || true

pr_number="$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')"
if [ -z "$pr_number" ]; then
Comment on lines +72 to +73

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '72,73p' .github/workflows/toc-update.yml
echo
echo "Current filter output:"
printf '[]\n' | jq -r '.[0].number'
echo "---"
echo "Fixed filter output:"
printf '[]\n' | jq -r '.[0].number // empty'

Repository: DragonAddons/RaidLogAuto

Length of output: 259


Fix null-to-string conversion in PR number lookup.

Line 72's jq filter outputs the literal string null (not an empty value) when gh pr list finds no matching PR. The [ -z "$pr_number" ] test on line 73 then evaluates to false, skipping the gh pr create call that should run on the first update.

Use .[0].number // empty to output nothing instead of null:

Proposed fix
-          pr_number="$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number')"
+          pr_number="$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number // empty')"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/toc-update.yml around lines 72 - 73, The jq expression
used to set pr_number returns the literal string "null" when no PR exists, so
the test [ -z "$pr_number" ] fails; update the gh pr list invocation to use the
jq filter .[0].number // empty so pr_number is an empty string when no PR is
found (e.g., change the command that sets pr_number to use --jq '.[0].number //
empty'), ensuring the subsequent if [ -z "$pr_number" ] correctly triggers gh pr
create when needed.

gh pr create \
--base master \
--head "$BRANCH" \
--title "$TITLE" \
--body "Automated update of \`## Interface\` versions in TOC files based on latest Blizzard CDN data." \
--label "automated"
else
echo "PR already exists for branch ${BRANCH}, force-push updated it"
fi
2 changes: 1 addition & 1 deletion RaidLogAuto.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 110207, 120001, 120000
## Interface-Mists: 50502, 50503
## Interface-BCC: 20505
## Interface-vanilla: 11508, 11507
## Interface-Vanilla: 11508, 11507

## Title: RaidLogAuto
## Notes: Automatically enables combat logging when entering a raid and disables it when leaving.
Expand Down
118 changes: 118 additions & 0 deletions scripts/generate_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/usr/bin/env bash
###############################################################################
# generate_changelog.sh
# Generates a clean changelog for the BigWigsMods packager release pipeline.
# Strips release commits and Co-authored-by lines from the git log.
#
# Usage: bash scripts/generate_changelog.sh [output_file]
# Env: TAG_NAME - tag to generate changelog for (optional)
# GITHUB_REPOSITORY - owner/repo for links (auto-set in GitHub Actions)
###############################################################################
set -euo pipefail

OUTPUT_FILE="${1:-.release/CHANGELOG.md}"
REPO="${GITHUB_REPOSITORY:?GITHUB_REPOSITORY must be set}"

# Derive project name from repo (e.g., "Xerrion/PhDamage" -> "PhDamage")
PROJECT_NAME="${REPO##*/}"

# ---------------------------------------------------------------------------
# Resolve current tag
# ---------------------------------------------------------------------------
if [[ -n "${TAG_NAME:-}" ]]; then
current_tag="$TAG_NAME"
else
current_tag="$(git describe --tags --abbrev=0)"
fi

# ---------------------------------------------------------------------------
# Resolve previous tag (may not exist for the first release)
# ---------------------------------------------------------------------------
previous_tag=""
if git describe --tags --abbrev=0 "${current_tag}^" >/dev/null 2>&1; then
previous_tag="$(git describe --tags --abbrev=0 "${current_tag}^")"
fi

# ---------------------------------------------------------------------------
# Tag date
# ---------------------------------------------------------------------------
tag_date="$(git log -1 --format=%as "${current_tag}")"

# ---------------------------------------------------------------------------
# Prepare output directory
# ---------------------------------------------------------------------------
mkdir -p "$(dirname "$OUTPUT_FILE")"

# ---------------------------------------------------------------------------
# Write header
# ---------------------------------------------------------------------------
{
echo "# ${PROJECT_NAME}"
echo ""
echo "## [${current_tag}](https://github.com/${REPO}/tree/${current_tag}) (${tag_date})"

if [[ -n "$previous_tag" ]]; then
printf "[Full Changelog](https://github.com/%s/compare/%s...%s)" \
"$REPO" "$previous_tag" "$current_tag"
else
printf "[Full Changelog](https://github.com/%s/commits/%s)" \
"$REPO" "$current_tag"
fi

printf " [Previous Releases](https://github.com/%s/releases)\n" "$REPO"
echo ""
} > "$OUTPUT_FILE"

# ---------------------------------------------------------------------------
# Determine log range
# ---------------------------------------------------------------------------
if [[ -n "$previous_tag" ]]; then
range="${previous_tag}..${current_tag}"
else
range="$current_tag"
fi

# ---------------------------------------------------------------------------
# Write commit list - one commit per NUL-delimited record
# ---------------------------------------------------------------------------
while IFS= read -r -d $'\0' record; do
subject=""
body=""

while IFS= read -r line; do
if [[ -z "$subject" ]]; then
if [[ -n "$line" ]]; then
subject="$line"
fi
continue
fi

body+="$line"$'\n'
done <<< "$record"

[[ -z "$subject" ]] && continue

if [[ "$subject" == chore:\ release\ * || "$subject" == chore\(*\):\ release\ * ]]; then
continue
fi

echo "- ${subject}" >> "$OUTPUT_FILE"

while IFS= read -r line; do
if [[ "$line" =~ ^[[:space:]]*[Cc][Oo]-[Aa][Uu][Tt][Hh][Oo][Rr][Ee][Dd]-[Bb][Yy]: ]]; then
continue
fi

if [[ "$line" =~ ^-+$ ]]; then
continue
fi

if [[ -z "$line" ]]; then
continue
fi

echo " ${line}" >> "$OUTPUT_FILE"
done <<< "$body"
done < <(git log --format='%s%n%b%x00' "$range")

echo "Changelog written to ${OUTPUT_FILE}"
Loading
Loading