Skip to content

chore: point to main (#237) #154

chore: point to main (#237)

chore: point to main (#237) #154

Workflow file for this run

name: Sync Nuon App
on:
push:
branches:
- main
workflow_dispatch:
inputs:
sync_all:
description: Sync all apps (ignore changed-dir detection)
required: true
default: "false"
type: choice
options:
- "true"
- "false"
NUON_DEBUG:
description: NUON_DEBUG
required: true
default: "false"
type: choice
options:
- "true"
- "false"
defaults:
run:
shell: bash
env:
NUON_DEBUG: "${{ github.event.inputs.NUON_DEBUG }}"
NUON_ORG_ID: orghrsmmlfozvjxraku0ubb4qq
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
has_changes: ${{ steps.set-matrix.outputs.has_changes }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get changed directories
id: set-matrix
run: |
if [ "${{ github.event.inputs.sync_all }}" = "true" ]; then
# Manual dispatch: sync every app dir (exclude dotfiles, scripts, docs)
CHANGED_DIRS=$(find . -maxdepth 1 -mindepth 1 -type d -printf '%f\n' | sort -u | grep -v '^\.' | grep -vE '^(scripts|docs)$' || true)
else
# Get list of changed files
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
# Extract unique top-level directories (excluding dotfiles, scripts, docs)
CHANGED_DIRS=$(echo "$CHANGED_FILES" | cut -d'/' -f1 | sort -u | grep -v '^\.' | grep -v '^$' | grep -vE '^(scripts|docs)$' || true)
fi
if [ -z "$CHANGED_DIRS" ]; then
echo "No app directories changed"
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "matrix={\"app\":[]}" >> $GITHUB_OUTPUT
else
# Build JSON array for matrix
JSON_ARRAY=$(echo "$CHANGED_DIRS" | jq -R -s -c 'split("\n") | map(select(length > 0))')
echo "Changed directories: $JSON_ARRAY"
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "matrix={\"app\":$JSON_ARRAY}" >> $GITHUB_OUTPUT
fi
sync:
needs: detect-changes
if: needs.detect-changes.outputs.has_changes == 'true'
runs-on: ubuntu-latest
name: Push to Nuon
strategy:
matrix: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check for skip-sync label
id: check_label
env:
GH_TOKEN: ${{ github.token }}
run: |
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --state merged --json number -q '.[0].number')
if [ -n "$PR_NUMBER" ]; then
LABELS=$(gh pr view "$PR_NUMBER" --json labels -q '.labels[].name')
if echo "$LABELS" | grep -q "skip-sync"; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "Skipping sync due to skip-sync label on PR #$PR_NUMBER"
fi
fi
- name: Install CLI
if: steps.check_label.outputs.skip != 'true'
run: ./scripts/install-cli.sh
- name: Sync ${{ matrix.app }}
if: steps.check_label.outputs.skip != 'true'
working-directory: ${{ matrix.app }}
run: nuon apps sync .
env:
NUON_API_TOKEN: ${{ secrets.NUON_API_TOKEN }}