From 0c258a2fc7923cfdf51c77d1cd2ea3ccb9c18a21 Mon Sep 17 00:00:00 2001 From: nextcloud-android-bot Date: Thu, 30 Jun 2022 07:42:52 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=94=84=20Synced=20local=20'.github/wo?= =?UTF-8?q?rkflows/'=20with=20remote=20'config/workflows/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nextcloud-android-bot --- .github/workflows/detectNewJavaFiles.yml | 34 +++++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/.github/workflows/detectNewJavaFiles.yml b/.github/workflows/detectNewJavaFiles.yml index 967af07c84..cda6fccaeb 100644 --- a/.github/workflows/detectNewJavaFiles.yml +++ b/.github/workflows/detectNewJavaFiles.yml @@ -1,18 +1,32 @@ name: "Detect new java files" on: - pull_request: - branches: [ master, stable-* ] + pull_request: + branches: [ master, stable-* ] -# Declare default permissions as read only. permissions: read-all jobs: - detectNewJavaFiles: - runs-on: ubuntu-latest + detectNewJavaFiles: + runs-on: ubuntu-latest + steps: + - id: file_changes + uses: trilom/file-changes-action@v1.2.4 + with: + output: ',' + - name: Detect new java files + run: | + if [ -z '${{ steps.file_changes.outputs.files_added }}' ]; then + echo "No new files added" + exit 0 + fi + new_java=$(echo '${{ steps.file_changes.outputs.files_added }}' | tr ',' '\n' | grep '\.java$' | cat) + if [ -n "$new_java" ]; then + # shellcheck disable=SC2016 + printf 'New java files detected:\n```\n%s\n```\n' "$new_java" | tee "$GITHUB_STEP_SUMMARY" + exit 1 + else + echo "No new java files detected" + exit 0 + fi - steps: - - uses: trilom/file-changes-action@v1.2.4 - - uses: actions/checkout@v2 - - name: Detect new java files - run: scripts/analysis/detectNewJavaFiles.sh From 7fb3c6f2ed369714371d09f9bc455949e1cad6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Thu, 30 Jun 2022 09:44:36 +0200 Subject: [PATCH 2/2] Remove detectNewJavaFiles script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now built into the workflow Signed-off-by: Álvaro Brey --- scripts/analysis/detectNewJavaFiles.sh | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100755 scripts/analysis/detectNewJavaFiles.sh diff --git a/scripts/analysis/detectNewJavaFiles.sh b/scripts/analysis/detectNewJavaFiles.sh deleted file mode 100755 index 9961d47bb1..0000000000 --- a/scripts/analysis/detectNewJavaFiles.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -count=$(grep \.java\" -c "$HOME"/files_added.json) - -if [ "$count" -eq 0 ] ; then - exit 0 -else - echo "New Java files detected! Please use Kotlin for new files. Number of new Java files: $count" - exit 1 -fi -