Skip to content

Commit

Permalink
Feature/dependabot gh actions (#45)
Browse files Browse the repository at this point in the history
* legger til en separat jobb for dependabot PRs
* build + test -> Deploy
  • Loading branch information
unorsk authored Sep 26, 2023
1 parent d63971c commit 38098ff
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions .github/workflows/deploy_feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ name: Deploy to dev
on:
pull_request:
types: [ ready_for_review, opened, synchronize ]
branches:
- '!dependabot/**'

env:
GITHUB_USERNAME: x-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

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"
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 38098ff

Please sign in to comment.