🔧 For monorepo use both frontend and backend labels#17
Conversation
WalkthroughAdds monorepo handling to .github/workflows/label-sync.yml by appending labels/frontend.yml and labels/backend.yml to CONFIG_FILES when REPO_TYPE is "monorepo", in addition to labels/general.yml. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~6 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (2)
.github/workflows/label-sync.yml (2)
10-11: Self-hosted runner portability: pin OS label or force bash shellThe script relies on bash features ($'\n'). On self-hosted Windows runners, default shell is PowerShell and this will break. Either:
- Add an OS label to ensure Linux (recommended), or
- Force shell: bash on the run steps.
Add either of the following:
Option A (runner labels):
runs-on: [self-hosted, Linux]Option B (force bash per step):
- name: Determine repository type from custom properties id: determine-type shell: bash run: | ... - name: Determine config files id: config shell: bash run: | ...
1-9: Missing permissions block may prevent label updatesEndBug/label-sync needs write access to labels (issues scope). With GitHub’s default read-only GITHUB_TOKEN permissions, the action can fail to update labels, especially on PR events. Declare explicit permissions.
Add this at the workflow top level (sibling of “on”):
permissions: contents: read issues: write
🧹 Nitpick comments (2)
.github/workflows/label-sync.yml (2)
34-57: Normalize repo type to lowercase to make matching resilientIf the custom property comes in with different casing (e.g., Monorepo, MONOREPO), the case statement won’t match.
Add normalization after reading REPO_TYPE:
- name: Determine config files id: config shell: bash run: | BASE_URL="https://raw.githubusercontent.com/brixion/.github/main/labels" REPO_TYPE="${{ steps.determine-type.outputs.repo_type }}" REPO_TYPE="$(echo "$REPO_TYPE" | tr '[:upper:]' '[:lower:]')" # Always include general labels CONFIG_FILES="$BASE_URL/general.yml" case "$REPO_TYPE" in frontend) CONFIG_FILES="$CONFIG_FILES"$'\n'"$BASE_URL/frontend.yml" ;; backend) CONFIG_FILES="$CONFIG_FILES"$'\n'"$BASE_URL/backend.yml" ;; monorepo) CONFIG_FILES="$CONFIG_FILES"$'\n'"$BASE_URL/frontend.yml"$'\n'"$BASE_URL/backend.yml" ;; general) : ;; # no-op; keep only general *) echo "Unknown repo type '$REPO_TYPE', using only general labels" ;; esac ...
55-56: Avoid confusing log when repo type is 'general'If codebase_type is literally "general", this falls into the default case and logs “Unknown repo type 'general'...”.
Consider adding an explicit general) case (no-op) to keep logs clean (see previous suggestion’s snippet).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/label-sync.yml(1 hunks)
🔇 Additional comments (2)
.github/workflows/label-sync.yml (2)
51-53: Monorepo handling: logic is correct; verify label precedence and merge orderNewline-separated config URLs are supported by EndBug/label-sync. Please double-check that the intended precedence is frontend then backend (i.e., backend definitions overriding duplicates from frontend due to later position). If the opposite is desired, swap their order.
12-33: Dependency on gh CLI on self-hosted runnerThis step requires gh to be installed/configured on the runner. On self-hosted machines that’s not guaranteed.
If gh is not guaranteed, replace with curl (jq optional but convenient):
- name: Determine repository type from custom properties id: determine-type shell: bash env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo "Fetching repo type from custom properties..." RESP=$(curl -sSf -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${GITHUB_TOKEN}" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/repos/${{ github.repository }}/properties/values") REPO_TYPE=$(printf '%s' "$RESP" | jq -r '.[] | select(.property_name=="codebase_type") | .value // empty') if [ -z "$REPO_TYPE" ] || [ "$REPO_TYPE" = "null" ]; then echo "No custom property 'codebase_type' found. Exiting workflow." exit 1 fi echo "Found custom property codebase_type: $REPO_TYPE" echo "repo_type=$REPO_TYPE" >> "$GITHUB_OUTPUT"
🔍 Samenvatting
Deze PR voegt label configuratie toe voor monorepo's waardoor meer bruikbare labels worden toegevoegd aan de repository
📝 Beschrijving
codebase_typevan een repository is ingesteld opmonorepo, dan moeten zowelgeneral.yaml,frontend.yamlenbackend.yamlingeladen worden✅ Checklist