Skip to content

Commit 0078bae

Browse files
authored
chore: reduce validation to one job (#9)
1 parent bf72238 commit 0078bae

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

.github/workflows/.pr-close.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR Closed
1+
name: .PR Close
22

33
on:
44
workflow_call:

.github/workflows/.pr-validate.yml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR Validate
1+
name: .PR Validate
22

33
on:
44
workflow_call:
@@ -9,7 +9,7 @@ on:
99
default: 'true'
1010
required: false
1111
type: string
12-
forks_allowed:
12+
reject_forks:
1313
description: 'Are forks allowed? [true|false]'
1414
default: 'false'
1515
required: false
@@ -20,39 +20,26 @@ on:
2020
type: string
2121

2222
jobs:
23-
conventional-commits:
24-
name: Conventional Commits
25-
if: inputs.conventional_commits != 'false'
23+
checks:
24+
name: Checks
2625
runs-on: ubuntu-22.04
2726
steps:
28-
- uses: amannn/action-semantic-pull-request@v5.4.0
27+
# Conventional commits
28+
- name: Conventional Commits
29+
uses: amannn/action-semantic-pull-request@v5.4.0
30+
if: inputs.conventional_commits != 'false'
2931
env:
3032
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3133

32-
- if: failure()
33-
run: |
34-
echo "Please use conventional commits in your PR title and re-run this job."
35-
echo "https://www.conventionalcommits.org/en/v1.0.0/"
36-
exit 1
34+
# Check for forks
35+
- name: Fork Check
36+
if: inputs.reject_forks != 'true' && github.event.pull_request.head.repo.fork
37+
run: exit 1
3738

38-
block-forks:
39-
name: Block Forks
40-
if: inputs.forks_allowed != 'true' && github.event.pull_request.head.repo.fork
41-
runs-on: ubuntu-22.04
42-
steps:
43-
- name: Block Forks
44-
run: |
45-
echo "These workflows do not work with forks. Our apologies for any inconvenience."
46-
exit 1
47-
48-
description:
49-
name: Description
50-
if: inputs.markdown_links != ''
51-
permissions:
52-
pull-requests: write
53-
runs-on: ubuntu-latest
54-
steps:
55-
- uses: bcgov-nr/action-pr-description-add@v1.1.1
39+
# Add PR Description, doesn't work with forks
40+
- name: PR Description
41+
if: inputs.reject_forks != 'true' && inputs.markdown_links != ''
42+
uses: bcgov-nr/action-pr-description-add@v1.1.1
5643
env:
5744
DOMAIN: apps.silver.devops.gov.bc.ca
5845
PREFIX: ${{ github.event.repository.name }}
@@ -70,3 +57,13 @@ jobs:
7057
7158
After merge, new images are deployed in:
7259
- [Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge.yml)
60+
61+
# Notify of any failures
62+
- name: Errors
63+
if: failure()
64+
run: |
65+
echo "Validation failed! Possible reasons:"
66+
echo " - Forks are not supported"
67+
echo " - Conventional commits required for PR titles and merges"
68+
echo " https://www.conventionalcommits.org/en/v1.0.0/"
69+
exit 1

0 commit comments

Comments
 (0)