Files
MusicBot/.github/workflows/validate-branch-naming.yml
purnell569 0941987234 Initial commit
Based on JMusicBot by jagrosh (https://github.com/jagrosh/MusicBot),
via the maintained fork by arif-banai (https://github.com/arif-banai/MusicBot).
See NOTICE for attribution. Licensed under Apache 2.0.

YouTube-side changes had broken playback entirely. Fixes:

- Apply the remote signature cipher independently of OAuth. Deciphering and
  authentication are unrelated, but the cipher was only configured when OAuth
  was enabled, so the default install fell back to the bundled extractor and
  failed with "Must find sig function from script: /s/player/<id>/...".
  Now always applied, and configurable via playback.youtube.remoteCipher.url.

- Add the ANDROID client and order the client list by reliability. ANDROID is
  currently the only client YouTube reliably streams to anonymously. WEB moves
  last, as YouTube answers it with SABR-only responses carrying no playable
  format ("No supported audio streams available, available types:").

- Detect sign-in failures across the whole exception graph. The existing hint
  could never fire: it matched the aggregate AllClientsFailedException message
  rather than the per-client reasons, and compared against an ASCII apostrophe
  while YouTube sends U+2019.

- Track youtube-source past 1.18.2, which predates the TV client User-Agent fix
  and the contentLength recovery fix.

Measured on previously failing tracks: 5/5 playing, stable across repeat runs
(was 1/5). No OAuth required. Adds 17 tests; 676 unit + 48 integration pass.
2026-09-11 13:47:20 +09:30

70 lines
2.6 KiB
YAML

name: Validate Branch Naming
# Validates branch naming conventions for feature/fix/chore/deps/release branches
# Runs only on pull requests
on:
pull_request:
types: [opened]
# Cancel in-progress runs for the same PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate-branch-name:
name: Validate Branch Naming Convention
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Validate branch name
run: |
# Extract branch name from pull request head ref
BRANCH_NAME="${{ github.head_ref }}"
echo "Validating branch: $BRANCH_NAME"
# Check each allowed pattern
VALID=false
# feature/<slug>
if [[ "$BRANCH_NAME" =~ ^feature/[a-z0-9-]+$ ]]; then
VALID=true
echo "✓ Branch name matches pattern: feature/<slug>"
# fix/<slug>
elif [[ "$BRANCH_NAME" =~ ^fix/[a-z0-9-]+$ ]]; then
VALID=true
echo "✓ Branch name matches pattern: fix/<slug>"
# chore/<slug>
elif [[ "$BRANCH_NAME" =~ ^chore/[a-z0-9-]+$ ]]; then
VALID=true
echo "✓ Branch name matches pattern: chore/<slug>"
# deps/<slug>
elif [[ "$BRANCH_NAME" =~ ^deps/[a-z0-9-]+$ ]]; then
VALID=true
echo "✓ Branch name matches pattern: deps/<slug>"
# release/<version> (e.g., release/0.6.3 or release/0.6.3-rc1)
elif [[ "$BRANCH_NAME" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9-]+)?$ ]]; then
VALID=true
echo "✓ Branch name matches pattern: release/<version>"
fi
if [[ "$VALID" == "false" ]]; then
echo "❌ Branch name '$BRANCH_NAME' does not match allowed patterns:"
echo ""
echo "Allowed branch patterns:"
echo " - feature/<slug> (e.g., feature/new-player-ui)"
echo " - fix/<slug> (e.g., fix/youtube-oauth)"
echo " - chore/<slug> (e.g., chore/update-dependencies)"
echo " - deps/<slug> (e.g., deps/youtube-source-pr195)"
echo " - release/<version> (e.g., release/0.6.3 or release/0.6.3-rc1)"
echo ""
echo "Branch names should:"
echo " - Use lowercase letters, numbers, and hyphens only"
echo " - Follow the pattern: <type>/<descriptive-slug>"
echo ""
exit 1
fi
echo "✅ Branch name is valid!"