Skip to content

Nightly Registry Update #70

Nightly Registry Update

Nightly Registry Update #70

name: Nightly Registry Update
on:
schedule:
# Run daily at 2 AM UTC
- cron: '0 2 * * *'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
synchronize-inventory:
runs-on: ubuntu-latest
outputs:
collector_result: ${{ steps.collector_watcher.outcome }}
java_result: ${{ steps.java_instrumentation_watcher.outcome }}
configuration_result: ${{ steps.configuration_watcher.outcome }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Detect repository type (if on a fork we use different git config)
id: repo_check
run: |
if [ "${{ github.repository }}" == "open-telemetry/opentelemetry-ecosystem-explorer" ]; then
echo "is_primary=true" >> $GITHUB_OUTPUT
else
echo "is_primary=false" >> $GITHUB_OUTPUT
fi
- name: Configure git (primary repository)
if: steps.repo_check.outputs.is_primary == 'true'
run: |
.github/scripts/use-cla-approved-bot.sh
- uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
if: steps.repo_check.outputs.is_primary == 'true'
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
- name: Configure git (forked repository)
if: steps.repo_check.outputs.is_primary == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Cache repository clones
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
with:
path: tmp_repos
key: tmp-repos
restore-keys: |
tmp-repos-
- name: Install uv
uses: astral-sh/setup-uv@e06108dd0aef18192324c70427afc47652e63a82 # v7.5.0
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Install dependencies
run: uv sync
- name: Run collector-watcher
id: collector_watcher
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: uv run collector-watcher
continue-on-error: true
- name: Run java-instrumentation-watcher
id: java_instrumentation_watcher
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: uv run java-instrumentation-watcher
continue-on-error: true
- name: Run configuration-watcher
id: configuration_watcher
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: uv run configuration-watcher
continue-on-error: true
- name: Check for inventory changes
id: check_changes
if: always()
run: |
git add -N ecosystem-registry/ 2>/dev/null || true
if git diff --quiet ecosystem-registry/ && [ -z "$(git ls-files --others --exclude-standard ecosystem-registry/)" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ steps.repo_check.outputs.is_primary == 'true' && steps.otelbot-token.outputs.token || secrets.GITHUB_TOKEN }}
run: |
BRANCH="otelbot/automated-inventory-update"
git add ecosystem-registry/
git commit -m "Update registry inventory"
git push -f origin HEAD:${BRANCH}
PR_TITLE="[automated] Update registry inventory"
PR_BODY="$(cat <<'EOF'
Automated nightly scan detected changes in registry data.
---
_This PR is automatically generated by the Nightly Registry Update workflow._
EOF
)"
if gh pr list --head ${BRANCH} --state open --json number --jq '.[0].number' | grep -q .; then
echo "Open PR already exists, updating..."
gh pr edit ${BRANCH} --title "${PR_TITLE}" --body "${PR_BODY}"
else
echo "Creating new PR..."
gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" --base main --head ${BRANCH}
fi
notify-collector:
permissions:
contents: read
issues: write
needs: [synchronize-inventory]
if: always()
uses: ./.github/workflows/reusable-workflow-notification.yml
with:
success: ${{ needs.synchronize-inventory.outputs.collector_result == 'success' }}
watcher-name: "collector-watcher"
notify-java:
permissions:
contents: read
issues: write
needs: [synchronize-inventory]
if: always()
uses: ./.github/workflows/reusable-workflow-notification.yml
with:
success: ${{ needs.synchronize-inventory.outputs.java_result == 'success' }}
watcher-name: "java-instrumentation-watcher"
notify-configuration:
permissions:
contents: read
issues: write
needs: [synchronize-inventory]
if: always()
uses: ./.github/workflows/reusable-workflow-notification.yml
with:
success: ${{ needs.synchronize-inventory.outputs.configuration_result == 'success' }}
watcher-name: "configuration-watcher"