Skip to content

Merge pull request #44 from Snowflake-Labs/feature/aem-publish-pipeline #1

Merge pull request #44 from Snowflake-Labs/feature/aem-publish-pipeline

Merge pull request #44 from Snowflake-Labs/feature/aem-publish-pipeline #1

name: Publish Skills to AEM on merge
on:
push:
branches: [main]
paths:
- 'skills/**/SKILL.md'
jobs:
detect_changes:
runs-on: ubuntu-latest
outputs:
skills_json: ${{ steps.detect.outputs.skills_json }}
has_changes: ${{ steps.detect.outputs.has_changes }}
steps:
- name: Detect changed SKILL.md files
id: detect
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
commit_sha="${{ github.sha }}"
changed_files=$(curl -sS \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/commits/${commit_sha}" \
| jq -r '.files[]? | select(.status != "removed") | .filename | select(startswith("skills/")) | select(endswith("/SKILL.md"))')
if [ -z "$changed_files" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "skills_json=[]" >> $GITHUB_OUTPUT
echo "No changed SKILL.md files"
exit 0
fi
echo "has_changes=true" >> $GITHUB_OUTPUT
objs='[]'
while IFS= read -r file; do
[ -z "$file" ] && continue
skill_name=$(echo "$file" | sed -E 's|skills/([^/]+)/SKILL.md|\1|')
objs=$(echo "$objs" | jq -c --arg name "$skill_name" '. + [{name:$name}]')
done <<< "$changed_files"
echo "skills_json=$objs" >> $GITHUB_OUTPUT
echo "Changed skills: $objs"
publish_skills:
needs: detect_changes
if: needs.detect_changes.outputs.has_changes == 'true'
strategy:
matrix:
skill: ${{ fromJson(needs.detect_changes.outputs.skills_json) }}
max-parallel: 2
fail-fast: false
uses: ./.github/workflows/publish-skill-to-aem.yml

Check failure on line 54 in .github/workflows/publish-skills-on-merge.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-skills-on-merge.yml

Invalid workflow file

error parsing called workflow ".github/workflows/publish-skills-on-merge.yml" -> "./.github/workflows/publish-skill-to-aem.yml" (source branch with sha:50cfae3e598f371a0e883304f7b6f1ec5278e5d9) : You have an error in your yaml syntax on line 180
with:
skill_name: ${{ matrix.skill.name }}
commit_sha: ${{ github.sha }}
secrets:
AEM_USERNAME: ${{ secrets.AEM_USERNAME_STAGING }}
AEM_PASSWORD: ${{ secrets.AEM_PASSWORD_STAGING }}
AEM_AUTHOR_URL: ${{ secrets.AEM_AUTHOR_URL_STAGING }}