Use appropriate conditional statements in CI workflows to ensure steps execute under the right circumstances and handle different environments gracefully.

Key practices:

Example from the discussions:

- name: Publish artifact marking this job as done
  uses: actions/upload-artifact@v4
  if: $  # Ensures cleanup runs even if job fails
  with:
    # artifact configuration

- name: Setup Python
  if: $  # Only on GitHub-hosted
  uses: ./.github/actions/setup-python

- name: Change Mirror Priorities  
  if: $  # Skip on self-hosted
  uses: ./.github/actions/apt-mirrors

This approach prevents workflow failures due to missing infrastructure, ensures proper cleanup, and optimizes resource usage by skipping unnecessary steps on different runner types.