Skip to content

Approve Python Log Output Changes

Approve changes to Python files that only affect lines of code that invoke a specified logging object.

Conditions (all must be true):

  • All files must end in .py
  • The changes only affect lines of code that invoke a logger object. This should be customized to your environment.

Automation Actions:

  • Applies a log-output-only label
  • Approves the PR
  • Posts a comment explaining that the change only affects logging output.

Approve Python Log Output Changes

# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  approve_python_log_output:
    # Triggered for python changes that only affect lines of code that invoke a logger object. 
    # Modify 'logger' to match your dev environment.
    if: 
      - {{ files | match(regex=r/\.py$/) | every }}
      - {{ source.diff.files | matchDiffLines(regex=r/^[+-].*logger\.(trace|debug|info|warn|error)/, ignoreWhiteSpaces=true) | every }}
    run: 
      - action: add-label@v1
        args:
          label: 'log-output-only'
      - action: approve@v1
      - action: add-comment@v1
        args:
          comment: |
            This PR has been approved because it only contains changes to log output

Additional Resources

gitStream is a workflow automation tool that enables you to use YAML configuration files to optimize your code review process. Add context to PRs, find code experts for reviews, and automate the merge process to maximize developer productivity.

Learn More about how gitStream Works.

Related Automations:

More Automations can be found on the Automation Library and Integrations pages.