Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 13 additions & 29 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
id: source-branch
if: inputs.enforce_source_branches
continue-on-error: true
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-source-branch@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-source-branch@v1.20.0
with:
github-token: ${{ secrets.MANAGE_TOKEN || github.token }}
allowed-branches: ${{ inputs.allowed_source_branches }}
Expand All @@ -103,7 +103,7 @@
- name: Validate PR title
id: title
continue-on-error: true
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-title@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-title@v1.20.0
with:
github-token: ${{ github.token }}
types: ${{ inputs.pr_title_types }}
Expand All @@ -113,33 +113,17 @@
- name: Validate PR description
id: description
continue-on-error: true
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-description@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-description@v1.20.0
with:
min-length: ${{ inputs.min_description_length }}

- name: Collect results and enforce blocking
id: collect
run: |
SOURCE_BRANCH="${{ steps.source-branch.outcome || 'skipped' }}"
TITLE="${{ steps.title.outcome }}"
DESCRIPTION="${{ steps.description.outcome }}"

{
echo "source_branch=${SOURCE_BRANCH}"
echo "title=${TITLE}"
echo "description=${DESCRIPTION}"
} >> "$GITHUB_OUTPUT"

# Fail the job if any blocking check failed
FAILED=""
if [ "${SOURCE_BRANCH}" = "failure" ]; then FAILED="${FAILED} source-branch"; fi
if [ "${TITLE}" = "failure" ]; then FAILED="${FAILED} title"; fi
if [ "${DESCRIPTION}" = "failure" ]; then FAILED="${FAILED} description"; fi

if [ -n "${FAILED}" ]; then
echo "::error::Blocking checks failed:${FAILED}"
exit 1
fi
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-blocking-collect@fix/pin-refs-v1.20.0

Check warning on line 122 in .github/workflows/pr-validation.yml

View workflow job for this annotation

GitHub Actions / Pinned Actions Check

Internal action not pinned to a version: uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-blocking-collect@fix/pin-refs-v1.20.0
with:
source-branch-outcome: ${{ steps.source-branch.outcome || 'skipped' }}
title-outcome: ${{ steps.title.outcome }}
description-outcome: ${{ steps.description.outcome }}

# ----------------- Tier 2: Advisory Checks (shared checkout, depends on Tier 1) -----------------
advisory-checks:
Expand All @@ -161,15 +145,15 @@
- name: Check PR metadata
id: metadata
continue-on-error: true
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-metadata@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-metadata@v1.20.0
with:
github-token: ${{ secrets.MANAGE_TOKEN || github.token }}
dry-run: ${{ inputs.dry_run && 'true' || 'false' }}

- name: Check PR size
id: size
continue-on-error: true
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-size@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-size@v1.20.0
with:
github-token: ${{ secrets.MANAGE_TOKEN || github.token }}
base-ref: ${{ github.base_ref }}
Expand All @@ -179,7 +163,7 @@
id: labels
if: inputs.enable_auto_labeler && !inputs.dry_run
continue-on-error: true
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-labels@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-labels@v1.20.0
with:
github-token: ${{ secrets.MANAGE_TOKEN || github.token }}
config-path: ${{ inputs.labeler_config_path }}
Expand All @@ -202,7 +186,7 @@

steps:
- name: PR Checks Summary
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-checks-summary@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-checks-summary@v1.20.0
with:
source-branch-result: ${{ needs.blocking-checks.outputs.source-branch-result || 'skipped' }}
title-result: ${{ needs.blocking-checks.outputs.title-result || 'skipped' }}
Expand All @@ -217,7 +201,7 @@
name: Notify
needs: [blocking-checks, advisory-checks, pr-checks-summary]
if: always() && github.event.pull_request.draft != true && !inputs.dry_run
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/slack-notify.yml@v1.20.0-beta.1
uses: LerianStudio/github-actions-shared-workflows/.github/workflows/slack-notify.yml@v1.20.0
with:
status: ${{ (needs.blocking-checks.outputs.source-branch-result == 'failure' || needs.blocking-checks.outputs.title-result == 'failure' || needs.blocking-checks.outputs.description-result == 'failure') && 'failure' || 'success' }}
workflow_name: "PR Validation"
Expand Down
43 changes: 43 additions & 0 deletions src/validate/pr-blocking-collect/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="https://github.com/LerianStudio.png" width="72" alt="Lerian" /></td>
<td><h1>pr-blocking-collect</h1></td>
</tr>
</table>

Collects outcomes from blocking validation checks, exposes them as step outputs, and fails the job if any check failed. Used as the final step in the blocking-checks tier of the pr-validation workflow.

## Inputs

| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `source-branch-outcome` | Outcome of the source branch validation step | No | `skipped` |
| `title-outcome` | Outcome of the PR title validation step | Yes | |
| `description-outcome` | Outcome of the PR description validation step | Yes | |

## Outputs

| Output | Description |
|--------|-------------|
| `source_branch` | Outcome of source branch validation |
| `title` | Outcome of PR title validation |
| `description` | Outcome of PR description validation |

## Usage as composite step

```yaml
- name: Collect results and enforce blocking
id: collect
uses: LerianStudio/github-actions-shared-workflows/src/validate/pr-blocking-collect@v1.x.x
with:
source-branch-outcome: ${{ steps.source-branch.outcome || 'skipped' }}
title-outcome: ${{ steps.title.outcome }}
description-outcome: ${{ steps.description.outcome }}
```

## Required permissions

```yaml
permissions:
contents: read
```
52 changes: 52 additions & 0 deletions src/validate/pr-blocking-collect/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: PR Blocking Collect
description: "Collects outcomes from blocking checks, writes them to GITHUB_OUTPUT, and fails the job if any check failed."

inputs:
source-branch-outcome:
description: Outcome of the source branch validation step
required: false
default: skipped
title-outcome:
description: Outcome of the PR title validation step
required: true
description-outcome:
description: Outcome of the PR description validation step
required: true

outputs:
source_branch:
description: Outcome of source branch validation
value: ${{ steps.collect.outputs.source_branch }}
title:
description: Outcome of PR title validation
value: ${{ steps.collect.outputs.title }}
description:
description: Outcome of PR description validation
value: ${{ steps.collect.outputs.description }}

runs:
using: composite
steps:
- name: Collect and enforce
id: collect
shell: bash
env:
SOURCE_BRANCH: ${{ inputs.source-branch-outcome }}
TITLE: ${{ inputs.title-outcome }}
DESCRIPTION: ${{ inputs.description-outcome }}
run: |
{
echo "source_branch=${SOURCE_BRANCH}"
echo "title=${TITLE}"
echo "description=${DESCRIPTION}"
} >> "$GITHUB_OUTPUT"

FAILED=""
if [ "${SOURCE_BRANCH}" = "failure" ]; then FAILED="${FAILED} source-branch"; fi
if [ "${TITLE}" = "failure" ]; then FAILED="${FAILED} title"; fi
if [ "${DESCRIPTION}" = "failure" ]; then FAILED="${FAILED} description"; fi

if [ -n "${FAILED}" ]; then
echo "::error::Blocking checks failed:${FAILED}"
exit 1
fi
Loading