Skip to content

Commit 2020d70

Browse files
authored
UML-2140 add documentation only workflow (#2461)
UML-2140: add documentation only workflow
1 parent 5521f91 commit 2020d70

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

.github/workflows/pull-request-path.yml

+36-8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ jobs:
5252
with:
5353
files: |
5454
terraform/**
55+
- name: get changed docs files in any folder
56+
id: changed-files-docs
57+
uses: tj-actions/changed-files@1864dc5311069c2319e40ddda20ebf24336dcba9
58+
with:
59+
files: |
60+
**/*.md
5561
- name: extract variables for workflow
5662
id: variables
5763
run: |
@@ -63,6 +69,9 @@ jobs:
6369
elif [[ ${{ steps.changed-files-admin.outputs.only_changed }} = "true" ]]
6470
then
6571
echo "path=$(echo admin)" >> $GITHUB_OUTPUT
72+
elif [[ ${{ steps.changed-files-docs.outputs.only_changed }} = "true" ]]
73+
then
74+
echo "path=$(echo docs)" >> $GITHUB_OUTPUT
6675
else
6776
echo "path=$(echo all)" >> $GITHUB_OUTPUT
6877
fi
@@ -72,6 +81,17 @@ jobs:
7281
run: |
7382
echo "path chosen - $SPECIFIC_PATH"
7483
84+
update_documentation:
85+
name: update documentation
86+
runs-on: ubuntu-latest
87+
needs:
88+
- workflow_variables
89+
steps:
90+
- name: only update documentation
91+
run: echo 'Only docs have changed - skipping rest of pipeline'
92+
if: |
93+
needs.workflow_variables.outputs.specific_path == 'docs'
94+
7595
terraform_lint:
7696
name: lint terraform code
7797
uses: ./.github/workflows/_lint-terraform.yml
@@ -83,7 +103,8 @@ jobs:
83103
secrets: inherit
84104
if: |
85105
always() &&
86-
needs.workflow_variables.result == 'success'
106+
needs.workflow_variables.result == 'success' &&
107+
needs.workflow_variables.outputs.specific_path != 'docs'
87108
88109
node_test:
89110
name: test node dependencies
@@ -176,7 +197,7 @@ jobs:
176197
needs.workflow_variables.result == 'success'
177198
178199
terraform_preproduction_plan_environment:
179-
name: terraform apply environment
200+
name: terraform plan preproduction environment
180201
uses: ./.github/workflows/_run-terraform.yml
181202
needs:
182203
- docker_build_scan_push
@@ -261,14 +282,21 @@ jobs:
261282
- slack_notify
262283
- workflow_variables
263284
- workspace_name
285+
- update_documentation
264286
steps:
265287
- name: workflow has ended without issue
266288
run: |
267-
echo "${{ needs.workflow_variables.outputs.parsed_branch }} PR environment tested, built and deployed"
268-
echo "Tag Used: ${{ needs.workflow_variables.outputs.parsed_branch }}-${{ needs.workflow_variables.outputs.short_sha }}"
269-
echo "URL: https://${{ needs.workspace_name.outputs.name }}.use-lasting-power-of-attorney.service.gov.uk"
289+
if [[ ${{ needs.workflow_variables.outputs.specific_path }} = 'docs' ]]
290+
then
291+
echo 'Ending docs workflow'
292+
else
293+
echo "${{ needs.workflow_variables.outputs.parsed_branch }} PR environment tested, built and deployed"
294+
echo "Tag Used: ${{ needs.workflow_variables.outputs.parsed_branch }}-${{ needs.workflow_variables.outputs.short_sha }}"
295+
echo "URL: https://${{ needs.workspace_name.outputs.name }}.use-lasting-power-of-attorney.service.gov.uk"
296+
fi
270297
if: |
271298
always() &&
272-
needs.ecr_scan_results.result == 'success' &&
273-
needs.slack_notify.result == 'success' &&
274-
needs.workflow_variables.result == 'success'
299+
((needs.ecr_scan_results.result == 'success' || needs.ecr_scan_results.result == 'skipped') &&
300+
(needs.slack_notify.result == 'success' || needs.slack_notify.result == 'skipped') &&
301+
needs.workflow_variables.result == 'success') ||
302+
needs.update_documentation.result == 'success'

0 commit comments

Comments
 (0)