From b4f8eef510801391b1d11d0fd9c19cc9ac588789 Mon Sep 17 00:00:00 2001 From: Jikoo Date: Sun, 3 Mar 2024 13:01:20 -0500 Subject: [PATCH] Update Actions --- .github/workflows/auto-merge-dependabot.yml | 34 ++++++------------- .github/workflows/ci.yml | 36 +++------------------ .github/workflows/pull_request.yml | 13 ++++++++ 3 files changed, 27 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml index 0da119a..ba6410d 100644 --- a/.github/workflows/auto-merge-dependabot.yml +++ b/.github/workflows/auto-merge-dependabot.yml @@ -1,29 +1,15 @@ name: Auto-merge Dependabot PRs on: - pull_request_target + workflow_run: + workflows: [ "Pull Request" ] + types: [ completed ] jobs: - auto-approve: - runs-on: ubuntu-latest - steps: - - name: Wait for build success - uses: fountainhead/action-wait-for-check@v1.0.0 - id: wait-for-build - if: github.actor == 'dependabot[bot]' - with: - token: ${{ secrets.GITHUB_TOKEN }} - checkName: 'Build Java 17' - ref: ${{ github.event.pull_request.head.sha || github.sha }} - - name: autoapprove - if: github.actor == 'dependabot[bot]' && steps.wait-for-build.outputs.conclusion == 'success' - uses: hmarr/auto-approve-action@v2.0.0 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: automerge - if: github.actor == 'dependabot[bot]' && steps.wait-for-build.outputs.conclusion == 'success' - uses: "pascalgn/automerge-action@v0.12.0" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_LABELS: "dependencies" - MERGE_METHOD: "squash" + automerge-dependabot-pr: + if: "github.actor == 'dependabot[bot]' + && github.event.workflow_run.event == 'pull_request' + && github.event.workflow_run.conclusion == 'success'" + uses: Jikoo/PlanarActions/.github/workflows/pr_automerge_complete.yml@master + with: + triggering-workflow-run: ${{ github.event.workflow_run.id }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ceffb29..c092278 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,37 +2,9 @@ name: Build on: push: - branches: - - master - pull_request_target: - types: [ opened, synchronize, reopened ] + branches-ignore: + - dependabot/** jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - java: [ 17 ] - name: Build Java ${{ matrix.java }} - steps: - - uses: actions/checkout@v3 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - cache: 'maven' - - - name: Cache SonarCloud packages - uses: actions/cache@v3 - with: - path: ~/.sonar/cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -P sonarcloud + run-ci: + uses: Jikoo/PlanarActions/.github/workflows/ci_maven.yml@master diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..236f785 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,13 @@ +name: Pull Request + +on: + pull_request: + +jobs: + run-ci: + uses: Jikoo/PlanarActions/.github/workflows/ci_maven.yml@master + store-dependabot-pr-data: + if: "github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'" + uses: Jikoo/PlanarActions/.github/workflows/pr_automerge_prep.yml@master + with: + pr-number: ${{ github.event.number }}