-
Notifications
You must be signed in to change notification settings - Fork 0
chore: inline shared release workflows #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8d997c8
dd9532a
f82992a
d7483b1
1a6fe05
62b5468
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 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 Use 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 |
||
| 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 | ||
| 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}" |
Uh oh!
There was an error while loading. Please reload this page.