From bd71aa3a5531dd3a920436679a068597f80225e1 Mon Sep 17 00:00:00 2001 From: Richard Harrah <1672786+ToppleTheNun@users.noreply.github.com> Date: Fri, 14 Apr 2023 21:31:22 -0400 Subject: [PATCH] fix github actions permissions (#73) --- .github/workflows/gradle.yml | 4 ++++ .github/workflows/mega-linter.yml | 30 +++--------------------------- version.properties | 2 +- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2eaddd4..5be069b 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -29,6 +29,10 @@ jobs: runs-on: ubuntu-latest needs: [ gradle_wrapper_validation ] if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" + permissions: + contents: write + issues: write + pull-requests: write steps: - name: Checkout code uses: actions/checkout@v3 # https://github.com/actions/checkout diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index baed680..bc38ddd 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -33,6 +33,9 @@ jobs: name: MegaLinter runs-on: ubuntu-latest needs: [ gradle_wrapper_validation ] + permissions: + issues: write + pull-requests: write steps: # Git Checkout - name: Checkout Code @@ -63,30 +66,3 @@ jobs: path: | megalinter-reports mega-linter.log - - # Create pull request if applicable (for now works only on PR from same repository, not from forks) - - name: Create Pull Request with applied fixes - id: cpr - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} - commit-message: "[MegaLinter] Apply linters automatic fixes" - title: "[MegaLinter] Apply linters automatic fixes" - labels: bot - - name: Create PR output - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - - # Push new commit if applicable (for now works only on PR from same repository, not from forks) - - name: Prepare commit - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') - run: sudo chown -Rc $UID .git/ - - name: Commit and push applied linter fixes - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') - uses: stefanzweifel/git-auto-commit-action@v4.16.0 - with: - branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} - commit_message: "[MegaLinter] Apply linters fixes" diff --git a/version.properties b/version.properties index e40f0f5..98515e8 100644 --- a/version.properties +++ b/version.properties @@ -1 +1 @@ -version=5.2.* +version=5.3.*