diff --git a/.github/workflows/pr-formatting.yaml b/.github/workflows/pr-formatting.yaml index 21028f5c..53f9e9d5 100644 --- a/.github/workflows/pr-formatting.yaml +++ b/.github/workflows/pr-formatting.yaml @@ -1,5 +1,5 @@ ## -# Copyright (C) 2024 Hedera Hashgraph, LLC +# Copyright (C) 2023-2024 Hedera Hashgraph, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ## + name: "PR Formatting" on: pull_request: @@ -31,8 +32,6 @@ on: - locked - unlocked - synchronize - branches: - - "*" defaults: run: @@ -42,42 +41,53 @@ permissions: statuses: write jobs: - title-check: - name: Title Check + pr-formatting-checks: + name: PR Formatting Checks runs-on: [self-hosted, Linux, medium, ephemeral] steps: - name: Check PR Title + id: title-check uses: step-security/conventional-pr-title-action@0eae74515f5a79f8773fa04142dd746df76666ac # v1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true - milestone-check: - name: Milestone Check - runs-on: [self-hosted, Linux, medium, ephemeral] - steps: - name: Check Milestone - if: ${{ github.event.pull_request.milestone == null }} + id: milestone-check run: | - echo "Milestone is not set. Failing the workflow." - exit 1 + if [[ "${{ github.event.pull_request.milestone }}" == "null" ]]; then + echo "Milestone is not set. Failing the workflow." + exit 1 + fi + continue-on-error: true - assignee-check: - name: Assignee Check - runs-on: [ self-hosted, Linux, medium, ephemeral ] - - steps: - name: Check Assignee - if: ${{ github.event.pull_request.assignees == null || github.event.pull_request.assignees[0] == null }} + id: assignee-check run: | - echo "Assignee is not set. Failing the workflow." - exit 1 + if [[ "${{ github.event.pull_request.assignees }}" == "null" || "${{ github.event.pull_request.assignees[0] }}" == "null" ]]; then + echo "Assignee is not set. Failing the workflow." + exit 1 + fi + continue-on-error: true - label-check: - name: Label Check - runs-on: [self-hosted, Linux, medium, ephemeral] - steps: - name: Check Labels - if: ${{ github.event.pull_request.labels == null || github.event.pull_request.labels.size == 0 }} + id: label-check + run: | + if [[ "${{ github.event.pull_request.labels }}" == "null" || "${{ github.event.pull_request.labels.size }}" == 0 ]]; then + echo "No labels are set. Failing the workflow." + exit 1 + fi + continue-on-error: true + + - name: Aggregate Results run: | - echo "No labels are set. Failing the workflow." - exit 1 + failed=false + for step in title-check milestone-check assignee-check label-check; do + if [ "${{ steps.$step.outcome }}" == "failure" ]; then + echo "Step $step failed" + failed=true + fi + done + if [ "$failed" == "true" ]; then + exit 1 + fi