diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml index ee383fda755..e898e8f378e 100644 --- a/.github/workflows/bandit.yml +++ b/.github/workflows/bandit.yml @@ -6,22 +6,16 @@ jobs: steps: - uses: actions/checkout@v3 - id: files - uses: jitterbit/get-changed-files@v1 - continue-on-error: true + uses: tj-actions/changed-files@v35.9.2 + with: + files: | + **/*.py + files_ignore: | + **/cvat-sdk/* - name: Run checks - env: - PR_FILES_AM: ${{ steps.files.outputs.added_modified }} - PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} run: | - PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED" - for FILE in $PR_FILES; do - EXTENSION="${FILE##*.}" - DIRECTORY="${FILE%%/*}" - if [[ "$EXTENSION" == 'py' && "$DIRECTORY" != 'cvat-sdk' ]]; then - CHANGED_FILES+=" $FILE" - fi - done + CHANGED_FILES=${{steps.files.outputs.all_changed_files}} if [[ ! -z $CHANGED_FILES ]]; then sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index b0793bfb6eb..ae7e3d4f878 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -6,8 +6,13 @@ jobs: steps: - uses: actions/checkout@v3 - id: files - uses: jitterbit/get-changed-files@v1 - continue-on-error: true + uses: tj-actions/changed-files@v35.9.2 + with: + files: | + cvat-sdk/**/*.py + cvat-cli/**/*.py + tests/python/**/*.py + dir_names: true - name: Run checks env: @@ -17,42 +22,8 @@ jobs: # If different modules use different Black configs, # we need to run Black for each python component group separately. # Otherwise, they all will use the same config. - ENABLED_DIRS=("cvat-sdk" "cvat-cli" "tests/python") - - isValueIn () { - # Checks if a value is in an array - # https://stackoverflow.com/a/8574392 - # args: value, array - local e match="$1" - shift - for e; do - [[ "$e" == "$match" ]] && return 0; - done - return 1 - } - - startswith () { - # Inspired by https://stackoverflow.com/a/2172367 - # Checks if the first arg starts with the second one - local value="$1" - local beginning="$2" - return $([[ $value == ${beginning}* ]]) - } - PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED" - UPDATED_DIRS="" - for FILE in $PR_FILES; do - EXTENSION="${FILE##*.}" - DIRECTORY="$(dirname $FILE)" - if [[ "$EXTENSION" == "py" ]]; then - for EDIR in ${ENABLED_DIRS[@]}; do - if startswith "${DIRECTORY}/" "${EDIR}/" && ! isValueIn "${EDIR}" ${UPDATED_DIRS[@]}; - then - UPDATED_DIRS+=" ${EDIR}" - fi - done - fi - done + UPDATED_DIRS=${{steps.files.outputs.all_changed_files}} if [[ ! -z $UPDATED_DIRS ]]; then sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index 808e8cacd24..5795c97895d 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -6,23 +6,18 @@ jobs: steps: - uses: actions/checkout@v3 - id: files - uses: jitterbit/get-changed-files@v1 - continue-on-error: true + uses: tj-actions/changed-files@v35.9.2 + with: + files: | + **/Dockerfile* - name: Run checks env: HADOLINT: "${{ github.workspace }}/hadolint" HADOLINT_VER: "2.1.0" VERIFICATION_LEVEL: "error" - PR_FILES_AM: ${{ steps.files.outputs.added_modified }} - PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} run: | - PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED" - for FILE in $PR_FILES; do - if [[ $FILE =~ 'Dockerfile' ]]; then - CHANGED_FILES+=" $FILE" - fi - done + CHANGED_FILES=${{steps.files.outputs.all_changed_files}} if [[ ! -z $CHANGED_FILES ]]; then curl -sL -o $HADOLINT "https://github.com/hadolint/hadolint/releases/download/v$HADOLINT_VER/hadolint-Linux-x86_64" && chmod 700 $HADOLINT diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml index 00797689320..ae222bb55b5 100644 --- a/.github/workflows/isort.yml +++ b/.github/workflows/isort.yml @@ -6,53 +6,21 @@ jobs: steps: - uses: actions/checkout@v3 - id: files - uses: jitterbit/get-changed-files@v1 - continue-on-error: true + uses: tj-actions/changed-files@v35.9.2 + with: + files: | + cvat-sdk/**/*.py + cvat-cli/**/*.py + tests/python/**/*.py + dir_names: true - name: Run checks - env: - PR_FILES_AM: ${{ steps.files.outputs.added_modified }} - PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} run: | # If different modules use different isort configs, # we need to run isort for each python component group separately. # Otherwise, they all will use the same config. - ENABLED_DIRS=("cvat-sdk" "cvat-cli" "tests/python") - - isValueIn () { - # Checks if a value is in an array - # https://stackoverflow.com/a/8574392 - # args: value, array - local e match="$1" - shift - for e; do - [[ "$e" == "$match" ]] && return 0; - done - return 1 - } - - startswith () { - # Inspired by https://stackoverflow.com/a/2172367 - # Checks if the first arg starts with the second one - local value="$1" - local beginning="$2" - return $([[ $value == ${beginning}* ]]) - } - PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED" - UPDATED_DIRS="" - for FILE in $PR_FILES; do - EXTENSION="${FILE##*.}" - DIRECTORY="$(dirname $FILE)" - if [[ "$EXTENSION" == "py" ]]; then - for EDIR in ${ENABLED_DIRS[@]}; do - if startswith "${DIRECTORY}/" "${EDIR}/" && ! isValueIn "${EDIR}" ${UPDATED_DIRS[@]}; - then - UPDATED_DIRS+=" ${EDIR}" - fi - done - fi - done + UPDATED_DIRS=${{steps.files.outputs.all_changed_files}} if [[ ! -z $UPDATED_DIRS ]]; then sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 9069b84f91c..3e8fd38356e 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -6,21 +6,17 @@ jobs: steps: - uses: actions/checkout@v3 - id: files - uses: jitterbit/get-changed-files@v1 - continue-on-error: true + uses: tj-actions/changed-files@v35.9.2 + with: + files: | + **/*.py - name: Run checks env: PR_FILES_AM: ${{ steps.files.outputs.added_modified }} PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} run: | - PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED" - for FILE in $PR_FILES; do - EXTENSION="${FILE##*.}" - if [[ "$EXTENSION" == 'py' ]]; then - CHANGED_FILES+=" $FILE" - fi - done + CHANGED_FILES=${{steps.files.outputs.all_changed_files}} if [[ ! -z $CHANGED_FILES ]]; then sudo apt-get --no-install-recommends install -y build-essential curl python3-dev python3-pip python3-venv diff --git a/.github/workflows/stylelint.yml b/.github/workflows/stylelint.yml index 4c1deebaf5f..a7d0dda662b 100644 --- a/.github/workflows/stylelint.yml +++ b/.github/workflows/stylelint.yml @@ -9,21 +9,15 @@ jobs: with: node-version: '16.x' - id: files - uses: jitterbit/get-changed-files@v1 - continue-on-error: true + uses: tj-actions/changed-files@v35.9.2 + with: + files: | + **/*.css + **/*.scss - name: Run checks - env: - PR_FILES_AM: ${{ steps.files.outputs.added_modified }} - PR_FILES_RENAMED: ${{ steps.files.outputs.renamed }} run: | - PR_FILES="$PR_FILES_AM $PR_FILES_RENAMED" - for FILE in $PR_FILES; do - EXTENSION="${FILE##*.}" - if [[ $EXTENSION == 'css' || $EXTENSION == 'scss' ]]; then - CHANGED_FILES+=" $FILE" - fi - done + CHANGED_FILES=${{steps.files.outputs.all_changed_files}} if [[ ! -z $CHANGED_FILES ]]; then yarn install --frozen-lockfile