From 38098ff9e5a01ebc29bd51716e036bc3231bf95a Mon Sep 17 00:00:00 2001 From: andrii <25188+unorsk@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:45:36 +0200 Subject: [PATCH] Feature/dependabot gh actions (#45) * legger til en separat jobb for dependabot PRs * build + test -> Deploy --- .github/workflows/dependabot.yaml | 28 +++++++++++++++++++++++++++ .github/workflows/deploy_feature.yaml | 5 +++-- .github/workflows/pr.yaml | 12 ++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/dependabot.yaml diff --git a/.github/workflows/dependabot.yaml b/.github/workflows/dependabot.yaml new file mode 100644 index 000000000..2b3579e47 --- /dev/null +++ b/.github/workflows/dependabot.yaml @@ -0,0 +1,28 @@ +name: Run tests for dependabot PRs +on: + pull_request: + types: [ ready_for_review, opened, synchronize ] + branches: + - 'dependabot/**' + +env: + GITHUB_USERNAME: x-access-token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + run-tests: + runs-on: ubuntu-latest + name: Run tests + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + - uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - run: mvn -B -e --settings .m2/maven-settings.xml clean install diff --git a/.github/workflows/deploy_feature.yaml b/.github/workflows/deploy_feature.yaml index 57e4cf1c6..dd46fee00 100644 --- a/.github/workflows/deploy_feature.yaml +++ b/.github/workflows/deploy_feature.yaml @@ -61,8 +61,9 @@ jobs: deploy-feature: runs-on: ubuntu-latest name: Deploy feature - needs: build - + needs: + - run-tests + - build steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index bf6c24c00..8ddb4b797 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -2,6 +2,8 @@ name: Deploy to dev on: pull_request: types: [ ready_for_review, opened, synchronize ] + branches: + - '!dependabot/**' env: GITHUB_USERNAME: x-access-token @@ -9,7 +11,7 @@ env: jobs: build: - if: github.event.pull_request.draft == false && ${{ github.actor != 'dependabot[bot]' }} + if: github.event.pull_request.draft == false permissions: contents: "read" id-token: "write" @@ -56,10 +58,12 @@ jobs: ${{ runner.os }}-maven- - run: mvn -B -e --settings .m2/maven-settings.xml clean install - deploy-main: + deploy-dev: runs-on: ubuntu-latest - name: Deploy main - needs: build + name: Deploy dev + needs: + - run-tests + - build steps: - uses: actions/checkout@v4 with: