Skip to content

Commit

Permalink
chore: add action to check readiness on renovate PRs before running CI (
Browse files Browse the repository at this point in the history
  • Loading branch information
UnicornChance authored Dec 20, 2024
1 parent 4988e05 commit c3155ee
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/actions/renovate-readiness/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Defense Unicorns
# SPDX-License-Identifier: AGPL-3.0-or-later OR LicenseRef-Defense-Unicorns-Commercial

name: renovate-readiness
description: "Check if Renovate PRs are ready for testing"

runs:
using: composite
steps:
# This is current a stub for future logic that would auto-detect readiness
# In lieu of that, we require an engineer to review changes and manually add the `renovate-ready` label
- name: Check if PR has the ready label
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'renovate-ready') }}
run: |
echo "This PR is not ready to run CI. Failing job."
exit 1
shell: bash
7 changes: 6 additions & 1 deletion .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
pull_request:
branches: [main]
# milestoned is added here as a workaround for release-please not triggering PR workflows (PRs should be added to a milestone to trigger the workflow).
types: [milestoned, opened, edited, synchronize]
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]

jobs:
title_check:
Expand All @@ -23,6 +24,10 @@ jobs:
with:
fetch-depth: 0

- name: Check renovate readiness
if: startsWith(github.event.pull_request.head.ref, 'renovate/') # Only call for Renovate PRs
uses: ./.github/actions/renovate-readiness

- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ name: Test
on:
pull_request:
branches: [main]
types: [milestoned, opened, reopened, synchronize]
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]

# Abort prior jobs in the same workflow / PR
concurrency:
Expand All @@ -25,6 +26,10 @@ jobs:
- name: Github Actions Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Check renovate readiness
if: startsWith(github.event.pull_request.head.ref, 'renovate/') # Only call for Renovate PRs
uses: ./.github/actions/renovate-readiness

- name: Environment setup
uses: ./.github/actions/setup
with:
Expand Down

0 comments on commit c3155ee

Please # to comment.