diff --git a/.github/workflows/logo-check.yml b/.github/workflows/logo-check.yml new file mode 100644 index 00000000..57273ab5 --- /dev/null +++ b/.github/workflows/logo-check.yml @@ -0,0 +1,69 @@ +name: Logo Check + +on: + pull_request_target: + branches: ['main'] + types: [opened, reopened, ready_for_review, synchronize] + +jobs: + check-logo-changes: + name: Check for Logo Changes + runs-on: ubuntu-latest + if: ${{ github.actor != 'dependabot' && github.actor != 'dependabot[bot]' && github.actor != 'github-actions' && github.actor != 'github-actions[bot]' && github.event.pull_request.draft == false }} + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Check for logo.png changes + id : logo_check + run: | + # Get the list of changed files + CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + echo "changed_files<> $GITHUB_OUTPUT + echo "$CHANGED_FILES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # Check if logo.png is in the changed files + if echo "$CHANGED_FILES" | grep -q "docs/_static/logo.png"; then + echo "❌ ERROR: Changes to docs/_static/logo.png are not allowed!" + echo "The logo.png file is protected and cannot be modified through pull requests." + echo "If you need to update the logo, please contact the repository maintainers." + echo "" + echo "Changed files in this PR:" + echo "$CHANGED_FILES" + exit 1 + else + echo "✅ No changes detected to docs/_static/logo.png" + fi + + - name: Comment on PR if logo changes detected + if: failure() + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `🚫 **Logo Change Blocked** + + Changes to \`docs/_static/logo.png\` are not allowed in pull requests. + + **Why is this blocked?** + - The logo is a protected asset that should only be updated by repository maintainers + - This helps maintain brand consistency and prevents unauthorized logo changes + + **What should you do?** + - Remove the logo.png changes from this PR + - If you need to update the logo, please contact the repository maintainers directly + + **Files changed in this PR:** + \`\`\` + ${process.env.INPUT_CHANGED_FILES || 'Unable to retrieve changed files'} + \`\`\`` + }) + env: + INPUT_CHANGED_FILES: ${{ steps.logo_check.outputs.changed_files }} + diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a59d336..32b02650 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Types of changes: saturation_pulse $0; } ``` +- Added a workflow to track changes in the `docs/_static/logo.png` file to prevent unnecessary modifications. ([#257](https://github.com/qBraid/pyqasm/pull/257)) ### Improved / Modified - Modified if statement validation to now include empty blocks as well. See [Issue #246](https://github.com/qBraid/pyqasm/issues/246) for details. ([#251](https://github.com/qBraid/pyqasm/pull/251)) diff --git a/docs/_static/logo.png b/docs/_static/logo.png index f41c51fc..eaa9312e 100644 Binary files a/docs/_static/logo.png and b/docs/_static/logo.png differ diff --git a/src/pyqasm/entrypoint.py b/src/pyqasm/entrypoint.py index 6cd3e02b..a368ca34 100644 --- a/src/pyqasm/entrypoint.py +++ b/src/pyqasm/entrypoint.py @@ -57,13 +57,20 @@ def loads(program: openqasm3.ast.Program | str, **kwargs) -> QasmModule: program (openqasm3.ast.Program or str): The OpenQASM program to validate. **kwargs: Additional arguments to pass to the loads function. - device_qubits (int): Number of physical qubits available on the target device. - device_cycle_time (float): The duration of a hardware device cycle, in seconds. - compiler_angle_type_size (int): The width of the angle type in the compiler. - extern_functions (dict): Dictionary of extern functions to be added to the module. - frame_in_def_cal (bool): Whether to allow frames in defcal. - frame_limit_per_port (int): The maximum number of frames per port. - play_in_cal_block (bool): Whether to allow play in defcal. + + - **device_qubits** (int): Number of physical qubits available on the target device. + + - **device_cycle_time** (float): The duration of a hardware device cycle, in seconds. + + - **compiler_angle_type_size** (int): The width of the angle type in the compiler. + + - **extern_functions** (dict): Dictionary of extern functions to be added to the module. + + - **frame_in_def_cal** (bool): Whether to allow frames in defcal. + + - **frame_limit_per_port** (int): The maximum number of frames per port. + + - **play_in_cal_block** (bool): Whether to allow play in defcal. Raises: TypeError: If the input is not a string or an `openqasm3.ast.Program` instance.