Skip to content

Commit

Permalink
ci: exclude dependabot from codeowner validation and auto format (#454)
Browse files Browse the repository at this point in the history
* ci: exclude dependabot from codeowners

* ci: use parenthesis around conditions

* ci: small fix to condition in first validation

* ci: address feedback - revert 2nd if logic

* ci(auto-format): skip dependabot
  • Loading branch information
nitrocode authored Oct 26, 2023
1 parent 6685696 commit 276f333
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# However, using a personal access token will cause events to be triggered.
# We need that to ensure a status gets posted after the auto-format commit.
# We also want to trigger tests if the auto-format made no changes.
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event.pull_request.state == 'open'
name: Privileged Checkout
with:
Expand All @@ -27,15 +27,15 @@ jobs:

# Do all the formatting stuff
- name: Auto Format
if: github.event.pull_request.state == 'open'
if: ${{ (github.event.pull_request.state == 'open') && (github.actor != 'dependabot[bot]') }}
shell: bash
env:
GITHUB_TOKEN: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host

# Commit changes (if any) to the PR branch
- name: Commit changes to the PR branch
if: github.event.pull_request.state == 'open'
if: ${{ (github.event.pull_request.state == 'open') && (github.actor != 'dependabot[bot]') }}
shell: bash
id: commit
env:
Expand Down Expand Up @@ -74,6 +74,7 @@ jobs:
if: >
contains(' 37929162 29139614 11232728 ', format(' {0} ', github.event.pull_request.user.id))
&& steps.commit.outputs.changed == 'false' && github.event.pull_request.state == 'open'
&& github.actor != 'dependabot[bot]'
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
repository: cloudposse/actions
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/validate-codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout source code at current commit"
uses: actions/checkout@v2
# Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved
uses: actions/checkout@v4

# Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved
- uses: mszostok/[email protected]
if: github.event.pull_request.head.repo.full_name == github.repository
# This condition verifies that the PR repo equals the Github Repo and it's NOT dependabot
if: ${{ (github.event.pull_request.head.repo.full_name == github.repository) && (github.actor != 'dependabot[bot]') }}
name: "Full check of CODEOWNERS"
with:
# For now, remove "files" check to allow CODEOWNERS to specify non-existent
Expand All @@ -22,7 +24,9 @@ jobs:
owner_checker_allow_unowned_patterns: "false"
# GitHub access token is required only if the `owners` check is enabled
github_access_token: "${{ secrets.REPO_ACCESS_TOKEN }}"

- uses: mszostok/[email protected]
# This condition verifies that the PR repo does NOT equal the Github Repo
if: github.event.pull_request.head.repo.full_name != github.repository
name: "Syntax check of CODEOWNERS"
with:
Expand Down

0 comments on commit 276f333

Please sign in to comment.