Skip to content

T6789: Test changed files #1

T6789: Test changed files

T6789: Test changed files #1

name: Check for unused imports using Pylint
on:
workflow_call:
jobs:
check-unused-imports:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout pull request merge ref
uses: actions/checkout@v3
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
repository: ${{ github.event.pull_request.base.repo.full_name }}
- name: Get changed files
id: changed-files
uses: actions/github-script@v4
with:
script: |
const prNumber = context.payload.pull_request.number;
const { data: files } = await github.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});
return files.map(file => file.filename).filter(file => file.endsWith('.py'));
- name: Print changed files
run: echo "Changed files: ${{ steps.changed-files.outputs.result }}"

Check failure on line 32 in .github/workflows/check-unused-imports.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/check-unused-imports.yml

Invalid workflow file

You have an error in your yaml syntax on line 32
# - uses: dorny/paths-filter@v3
# id: py-changes
# with:
# filters: |
# src:
# - 'src/**'
# - name: Set up Python
# if: steps.py-changes.outputs.src == 'true'
# uses: actions/setup-python@v3
# with:
# python-version: 3.11
# - name: Install dependencies
# if: steps.py-changes.outputs.src == 'true'
# run: |
# python -m pip install --upgrade pip
# pip install pylint
# - name: Check unused imports (pylint)
# if: steps.py-changes.outputs.src == 'true'
# run: |
# pylint_files=$(git ls-files *.py src/migration-scripts)
# set +e
# output=$(pylint --disable=all --enable=W0611 $pylint_files)
# exit_code=$?
# set -e
# echo "$output"
# run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# message=":white_check_mark: No issues found in *unused-imports* check."
# if [[ $exit_code -ne 0 ]]; then
# message=":x: Issues found in *unused-imports* check. "
# fi
# echo "WORKFLOW_MESSAGE=${message}. Please refer the [workflow run]($run_url)" >> $GITHUB_ENV
# exit $exit_code
# - name: Add PR comment
# if: ${{ always() && env.WORKFLOW_MESSAGE != '' }}
# uses: mshick/add-pr-comment@v2
# with:
# message: |-
# ${{ env.WORKFLOW_MESSAGE }}
# message-id: "UNUSED_IMPORTS_VALIDATION"
# allow-repeats: false