Skip to content

Commit

Permalink
Made build and test Workflows to adapt to Dependabot and non-Dependab…
Browse files Browse the repository at this point in the history
…ot triggers (#178)
  • Loading branch information
CatChen authored Aug 23, 2022
1 parent 4354f91 commit 986d186
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ on:
jobs:
build:
name: Build
if: ${{ !startsWith(github.head_ref, 'workflows/tests/') && github.actor != 'dependabot[bot]' }}
if: |-
${{
!startsWith(github.head_ref, 'workflows/tests/') && (
(github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'workflow_run' && github.actor == 'dependabot[bot]')
)
}}
runs-on: ubuntu-latest
permissions: write-all
steps:
Expand All @@ -35,6 +41,6 @@ jobs:

- uses: CatChen/check-git-status-action@v1
with:
fail-if-not-clean: true
fail-if-not-clean: ${{ github.actor != 'dependabot[bot]' }}
push-if-not-clean: true
github-token: ${{ secrets.CHECK_GIT_STATUS_ACTION_TOKEN }}
13 changes: 10 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ on:
jobs:
test:
name: Test
if: ${{ !startsWith(github.head_ref, 'workflows/tests/') && github.head_ref != 'refs/heads/main' && github.actor != 'dependabot[bot]' }}
if: |-
${{
!startsWith(github.head_ref, 'workflows/tests/') &&
github.head_ref != 'refs/heads/main' &&(
(github.event_name == 'pull_request' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'workflow_run' && github.actor == 'dependabot[bot]')
)
}}
runs-on: ubuntu-latest
permissions: write-all

Expand All @@ -26,10 +33,10 @@ jobs:
- name: Git fetch
env:
TEST_BRANCH_NAME: ${{ github.head_ref }}
BASE_BRANCH_NAME: ${{ github.head_ref }}
run: |
git fetch --unshallow origin
git checkout $TEST_BRANCH_NAME
git checkout $BASE_BRANCH_NAME
- name: Make commit
env:
Expand Down

0 comments on commit 986d186

Please sign in to comment.