Optimize default prompts to greatly reduce token usage and improve ef… #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Blueprint Source URL | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| paths: | |
| - "**.yaml" | |
| - "! .github/**" | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| update-url: | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update URLs dynamically | |
| run: | | |
| BRANCH=${GITHUB_REF#refs/heads/} | |
| echo "BRANCH=$BRANCH" >> $GITHUB_ENV | |
| BASE_URL="https://github.com/${{ github.repository }}/blob/$BRANCH" | |
| echo "Updating source_url for branch: $BRANCH" | |
| find . -type f -name "*.yaml" ! -path "./.github/*" | while read -r file; do | |
| if grep -q "^ *source_url:" "$file"; then | |
| RELATIVE_PATH=$(echo "$file" | sed 's|^\./||') | |
| NEW_URL="${BASE_URL}/${RELATIVE_PATH}" | |
| sed -i "s|^\( *\)source_url:.*|\1source_url: $NEW_URL|" "$file" | |
| echo "Processed: $RELATIVE_PATH" | |
| fi | |
| done | |
| - name: Commit and Push changes | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add . | |
| if ! git diff --quiet --staged; then | |
| git commit -m "chore: sync source_url to branch $BRANCH [skip ci]" | |
| git pull --rebase origin $BRANCH | |
| git push origin $BRANCH | |
| else | |
| echo "No changes to commit." | |
| fi |