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
#1144)

## Description

Adds a new action that checks renovate PR readiness and fails CI before
using the large runners if the PR is not ready. At this point the action
just checks for a `renovate-ready` label, but this could be changed in
the future to look for changes in the PR, etc.

## Related Issue

Related to #168

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Steps to Validate

This functionality was validated on [my
fork](https://github.com/BagelLab/uds-core) due to some of the
complexities around testing it on this repo. A demo/walkthrough can be
provided by appointment.

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor
Guide](https://github.com/defenseunicorns/uds-template-capability/blob/main/CONTRIBUTING.md)
followed
  • Loading branch information
mjnagel authored Dec 20, 2024
1 parent 2764d03 commit 83d81c6
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 7 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/checkpoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ name: Checkpoint UDS Core
on:
pull_request:
# 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, reopened, synchronize]
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths:
- packages/checkpoint-dev/**
- .github/workflows/checkpoint**
Expand Down Expand Up @@ -35,6 +36,10 @@ jobs:
steps:
- 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
9 changes: 8 additions & 1 deletion .github/workflows/docs-shim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ name: CI Docs

on:
pull_request:
types: [milestoned, opened, reopened, synchronize]
# 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).
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths:
- "**.md"
- "**.jpg"
Expand All @@ -28,6 +30,11 @@ jobs:
steps:
- name: Checkout repository
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: lint-check
uses: ./.github/actions/lint-check

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pull-request-conditionals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ name: Filter
on:
pull_request:
# 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, reopened, synchronize]
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths-ignore:
- "**.md"
- "**.jpg"
Expand Down Expand Up @@ -62,6 +63,10 @@ jobs:
- name: Checkout the code
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

# Uses a custom action to filter paths for source packages.
- name: Check src paths
id: path-filter
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/slim-dev-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ name: Slim Dev
on:
pull_request:
# 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, reopened, synchronize]
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths:
- src/pepr/**
- src/keycloak/**
Expand Down Expand Up @@ -49,6 +50,9 @@ jobs:
steps:
- name: Checkout the code
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
- name: Deploy Slim Dev Bundle
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-aks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ on:
schedule:
- cron: '0 0 * * 0' # Every Sunday Midnight (UTC) / Saturday 5pm MT
pull_request:
types: [milestoned, opened, reopened, synchronize]
# 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).
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths:
- tasks/iac.yaml
- .github/bundles/aks/*
Expand Down Expand Up @@ -48,6 +50,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

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

- name: Azure login
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-eks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ on:
schedule:
- cron: '0 0 * * 0' # Every Sunday Midnight (UTC) / Saturday 5pm MT
pull_request:
types: [milestoned, opened, reopened, synchronize]
# 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).
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths:
- tasks/iac.yaml
- .github/bundles/eks/*
Expand Down Expand Up @@ -44,6 +46,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

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

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-rke2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ on:
schedule:
- cron: '0 0 * * 0' # Every Sunday Midnight (UTC) / Saturday 5pm MT
pull_request:
types: [milestoned, opened, reopened, synchronize]
# 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).
# labeled is added here to allow for "manual" triggering of CI on renovate PRs
types: [milestoned, opened, reopened, synchronize, labeled]
paths:
- tasks/iac.yaml
- .github/bundles/rke2/*
Expand Down Expand Up @@ -44,6 +46,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

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

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
Expand Down

0 comments on commit 83d81c6

Please sign in to comment.