Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 45 additions & 7 deletions .github/workflows/publish-catalog.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
name: Publish Catalog Release

on:
push:
branches:
- main
paths:
- "skills/**"
- "scripts/generate_catalog.py"
- ".github/workflows/publish-catalog.yml"
schedule:
- cron: "0 4 * * *"
Comment on lines +4 to +5
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Re-enable push trigger for catalog-source changes

This workflow now runs only on daily schedule and workflow_dispatch, so merges to main that update skills/** or catalog-generation inputs no longer publish immediately and can be delayed until the next cron window (or missed if scheduled workflows are paused). That is a regression from the prior push-based automation path and weakens the repository’s automatic-on-main release flow for catalog updates.

Useful? React with 👍 / 👎.

workflow_dispatch:
inputs:
catalog_version:
Expand All @@ -28,13 +23,52 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Check for new commits on main since latest catalog release
id: changes
shell: bash
run: |
git fetch --force --tags origin main

latest_tag=$(git tag --list "${{ env.CATALOG_TAG_PREFIX }}*" --sort=-v:refname | head -n 1)
main_ref="origin/main"

if [[ -z "$latest_tag" ]]; then
if [[ "$(git rev-list --count "$main_ref")" -gt 0 ]]; then
echo "has_new_commits=true" >> "$GITHUB_OUTPUT"
else
echo "has_new_commits=false" >> "$GITHUB_OUTPUT"
fi
echo "latest_tag=" >> "$GITHUB_OUTPUT"
exit 0
fi

commits_since_tag=$(git rev-list --count "${latest_tag}..${main_ref}")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict new-commit detection to catalog-relevant changes

The check git rev-list --count "${latest_tag}..${main_ref}" marks any commit on main as requiring a new catalog release, regardless of whether catalog inputs changed. As a result, unrelated commits (for example docs-only updates) will still produce new catalog-v* releases with identical assets, creating unnecessary release churn and version inflation.

Useful? React with 👍 / 👎.


if [[ "$commits_since_tag" -gt 0 ]]; then
echo "has_new_commits=true" >> "$GITHUB_OUTPUT"
else
echo "has_new_commits=false" >> "$GITHUB_OUTPUT"
fi

echo "latest_tag=$latest_tag" >> "$GITHUB_OUTPUT"
Comment on lines +29 to +56

- name: Skip release when main has no new commits
if: steps.changes.outputs.has_new_commits != 'true'
shell: bash
run: |
echo "No new commits on main since latest catalog tag '${{ steps.changes.outputs.latest_tag }}'. Skipping release."

- name: Set up Python
if: steps.changes.outputs.has_new_commits == 'true'
uses: actions/setup-python@v6
with:
python-version: "3.12"

- name: Validate catalog version
if: steps.changes.outputs.has_new_commits == 'true'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allow manual dispatch to bypass the commit-delta gate

All publishing steps are now gated on steps.changes.outputs.has_new_commits == 'true', which also applies to workflow_dispatch runs. If the latest catalog tag is already on origin/main (for example, rerunning after a failed asset upload or trying to republish with an explicit catalog_version), the workflow exits before versioning and release steps, so manual recovery/backfill is blocked unless a new commit is added.

Useful? React with 👍 / 👎.

Comment on lines +59 to +71
id: version
shell: bash
run: |
Expand All @@ -56,9 +90,11 @@ jobs:
echo "tag=${{ env.CATALOG_TAG_PREFIX }}$version" >> "$GITHUB_OUTPUT"

- name: Generate catalog outputs in CI
if: steps.changes.outputs.has_new_commits == 'true'
run: python3 scripts/generate_catalog.py

- name: Package catalog release assets
if: steps.changes.outputs.has_new_commits == 'true'
shell: bash
run: |
rm -rf artifacts/catalog-release artifacts/catalog-payload
Expand All @@ -72,13 +108,15 @@ jobs:
)

- name: Upload packaged catalog artifacts
if: steps.changes.outputs.has_new_commits == 'true'
uses: actions/upload-artifact@v6
with:
name: dotnet-skills-catalog-${{ steps.version.outputs.version }}
path: artifacts/catalog-release/*
if-no-files-found: error

- name: Create or update catalog release
if: steps.changes.outputs.has_new_commits == 'true'
env:
GH_TOKEN: ${{ github.token }}
shell: bash
Expand Down
Loading