Skip to content

fix(deps): update github.com/openshift/api digest to 6733660 (main) #6480

fix(deps): update github.com/openshift/api digest to 6733660 (main)

fix(deps): update github.com/openshift/api digest to 6733660 (main) #6480

name: PR Bundle Manifests Validator
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- 'main'
- 'release-[0-9]+.[0-9]+'
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
check-bundle:
name: Validate Bundle Manifests
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
steps:
- name: Checkout PR branch
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
persist-credentials: false
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: 'go.mod'
- name: Regenerate bundle manifests
run: make bundles build-installers
- name: Check for changes
id: check
run: |
# Since operator-sdk 1.26.0, `make bundle` changes the `createdAt` field from the bundle every time we run it.
# The `git diff` below checks if only the createdAt field has changed. If it is the only change, it is ignored.
# Inspired from https://github.com/operator-framework/operator-sdk/issues/6285#issuecomment-1415350333
if git diff --quiet -I'^ createdAt: ' bundle config dist; then
echo "✅ Bundle manifests are up to date"
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "Bundle manifests are out of sync"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Auto-commit and push updated bundle manifests
id: autopush
# Only attempt on same-repo PRs (not forks) for security; best-effort — failure falls through to the next step
if: steps.check.outputs.changed == 'true' && github.event.pull_request.head.repo.full_name == github.repository
continue-on-error: true
env:
RHDH_BOT_TOKEN: ${{ secrets.RHDH_BOT_TOKEN }}
HEAD_REF: ${{ github.head_ref }}
run: |
if [[ -z "${RHDH_BOT_TOKEN}" || -z "${HEAD_REF}" ]]; then
echo "::warning::RHDH_BOT_TOKEN or HEAD_REF is not set, skipping auto-push"
exit 0
fi
git config user.name "rhdh-bot"
git config user.email "rhdh-bot@redhat.com"
git remote set-url origin "https://x-access-token:${RHDH_BOT_TOKEN}@github.com/${{ github.repository }}.git"
git add bundle/ config/ dist/
git commit -m "chore: regenerate bundle manifests"
if git push origin "HEAD:${HEAD_REF}"; then
echo "pushed=true" >> "$GITHUB_OUTPUT"
else
echo "pushed=false" >> "$GITHUB_OUTPUT"
git reset --mixed HEAD~1
fi
- name: Fail if bundle manifests are out of sync
if: steps.check.outputs.changed == 'true' && steps.autopush.outputs.pushed != 'true'
run: |
echo "::error::Bundle manifests are out of sync with the code"
echo ""
echo "❌ The bundle manifests need to be regenerated."
echo ""
echo "This usually happens when you modify:"
echo " - CRD definitions (api/)"
echo " - Operator manifests (config/manifests/)"
echo " - RBAC permissions (config/rbac/)"
echo " - Webhook configurations (config/webhook/)"
echo ""
echo "To fix this, run:"
echo " make bundles build-installers"
echo " git add bundle/ config/ dist/"
echo " git commit -m 'chore: regenerate bundle manifests'"
echo " git push"
echo ""
echo "Changed files:"
git diff --name-only -I'^ createdAt: ' bundle config dist
exit 1