diff --git a/.github/actions/check-formatting/action.yml b/.github/actions/check-formatting/action.yml index 89ad28ffd8..72cf9f45cb 100644 --- a/.github/actions/check-formatting/action.yml +++ b/.github/actions/check-formatting/action.yml @@ -6,8 +6,6 @@ runs: - name: Checkout code uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Check for formatting - uses: leventeBajczi/intellij-idea-format@v1.0 + uses: ./.github/actions/cache-build with: - settings-file: "./.idea/codeStyles/Project.xml" - file-mask: "*.java,*.kt" - additional-options: "-dry" \ No newline at end of file + arguments: spotlessCheck \ No newline at end of file diff --git a/.github/workflows/reapply_copyright.yml b/.github/workflows/reapply_copyright.yml deleted file mode 100644 index 3acc9e3876..0000000000 --- a/.github/workflows/reapply_copyright.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Reapply Copyright - -on: - workflow_dispatch: - inputs: - file_mask: - description: 'File mask to reapply license header (argument to find)' - required: true - default: '-name "*.java" -o -name "*.kt" -o -name "*.kts"' - direct-commit: - type: boolean - default: false - description: Commit directly to source (instead of opening a PR) - -jobs: - copyright_checker: - runs-on: ubuntu-latest - steps: - - uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 - id: generate-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - - name: Checkout repository - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - token: ${{ steps.generate-token.outputs.token }} - - - name: Run Copyright Checker - shell: bash {0} - run: | - set +x - - for file in $(find . -type f \( ${{ inputs.file_mask }} \)); do - last_modified_year=$(git log -1 --format=%ad --date=format:%Y "$file") - echo "Checking file $file, last modified $last_modified_year" - - header_exists=$(head -n 2 "$file" | tail -n 1 | grep -c "Budapest University of Technology") - - echo "Header exists for $file: $header_exists" - - if [[ $header_exists -eq 0 ]]; then - echo "Adding copyright header to $file" - cat ./doc/copyright-header.txt "$file" > tmp_026204264 - mv tmp_026204264 "$file" - fi - - header_year=$(head -n 2 "$file" | tail -n 1 | grep -o -E '[0-9]{4}') - - echo "Header year for $file: $header_year" - - if [[ "$header_year" != "$last_modified_year" ]]; then - echo "Updating copyright year to $last_modified_year in $file (was $header_year)" - sed -i "s/Copyright [0-9]\{4\}/Copyright $last_modified_year/g" "$file" - fi - done - - - name: Create Pull Request - if: ${{ !inputs.direct-commit }} - uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 - with: - commit-message: "Reapplied copyright" - branch: "copyright-reapply" - title: '[AutoPR] Reaplied copyright' - token: ${{ steps.generate-token.outputs.token }} - committer: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com> - author: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com> - - - name: Commit changes - if: ${{ inputs.direct-commit }} - uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a - with: - commit_message: "Reapplied copyright" - commit_user_name: ThetaBotMaintainer[bot] - commit_user_email: 139346997+ThetaBotMaintainer[bot]@users.noreply.github.com - commit_author: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com> \ No newline at end of file diff --git a/.github/workflows/reformat-code.yml b/.github/workflows/reformat-code.yml index fe6fc24d9f..29411d1f37 100644 --- a/.github/workflows/reformat-code.yml +++ b/.github/workflows/reformat-code.yml @@ -3,10 +3,6 @@ name: Reformat code on: workflow_dispatch: inputs: - file_mask: - description: 'File mask to reformat' - required: true - default: '*.java,*.kts,*.kt' direct-commit: type: boolean default: false @@ -28,10 +24,9 @@ jobs: token: ${{ steps.generate-token.outputs.token }} - name: Do reformat - uses: leventeBajczi/intellij-idea-format@v1.0 + uses: ./.github/actions/cache-build with: - settings-file: "./.idea/codeStyles/Project.xml" - file-mask: ${{ inputs.file_mask }} + arguments: spotlessApply - name: Create Pull Request if: ${{ !inputs.direct-commit }}