Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check to see if auto tagging will work #108

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
05aa9c3
Add check to see if auto tagging will work
katybaulch Mar 26, 2024
3e5b7c9
Double quote to avoid word splitting
katybaulch Mar 26, 2024
376cad4
Update ci-cd.yml
katybaulch Mar 26, 2024
c4f8161
debug
katybaulch Mar 26, 2024
4a64f64
Sanitise input variables
katybaulch Mar 26, 2024
cc2c4c8
Sanitise input variables for failing auto tagging at PR job
katybaulch Mar 26, 2024
83b81c1
Double quote to avoid word splitting
katybaulch Mar 26, 2024
94c8890
Debug
katybaulch Mar 26, 2024
7eae076
Change to unique id
katybaulch Mar 26, 2024
07b705b
Capitalise env var names
katybaulch Mar 26, 2024
e564cfd
Change syntax for referencing step env vars
katybaulch Mar 26, 2024
a0bbc8a
Use contexts and make envs job level
katybaulch Mar 26, 2024
8742cff
Capitalise composite action input names
katybaulch Mar 26, 2024
3d97ce6
Swap to branch
katybaulch Mar 26, 2024
9ef1dda
Merge branch 'main' into PDCT-851/fail-the-auto-tagging-build-during-…
katybaulch Mar 26, 2024
db17dc1
Merge branch 'main' into PDCT-851/fail-the-auto-tagging-build-during-…
katybaulch Mar 27, 2024
fb36d5d
Run all tests using make test
katybaulch Mar 27, 2024
6f9b89d
Updated step names
katybaulch Mar 27, 2024
633c6ff
Update step name
katybaulch Mar 27, 2024
6e6770c
Fail the build if the next tag not found
katybaulch Mar 27, 2024
d8e6452
Debug to see event info
katybaulch Mar 27, 2024
a1d623f
Add skip option for autotag & remove redundant quotes
katybaulch Mar 27, 2024
2433570
Move check auto-tagging will work job to separate workflow
katybaulch Mar 27, 2024
d90d6e2
Remove debug
katybaulch Mar 27, 2024
32b3a24
Only run release job if we don't skip the autotagging
katybaulch Mar 27, 2024
41e9db1
Use main for get-next-tag-from-pr-body
katybaulch Mar 27, 2024
e8bc4e5
Use v2 of get-next-tag-from-pr-body
katybaulch Mar 27, 2024
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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Please include:
Please select the option below that is most relevant from the list below. This
will be used to generate the next tag version name during auto-tagging.

- [ ] Skip auto-tagging
- [ ] Patch
- [ ] Minor version
- [ ] Major version
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/auto-tagging-failsafe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Auto-Tagging Fail Safe

on:
pull_request:
types: [edited]
branches:
- main

permissions: read-all

# https://github.com/marketplace/actions/docker-layer-caching
jobs:
check-auto-tagging-will-work:
if: ${{ ! startsWith(github.ref, 'refs/tags') && ! startsWith(github.ref, 'refs/heads/main') }}
runs-on: ubuntu-latest
# User controlled input needs to be santitised beforehand e.g., by adding an
# intermediate env var to prevent the workflow being exposed to a critical
# command injection attack
env:
PR_BODY: "${{ github.event.pull_request.body }}"
steps:
- name: Determine new tag version from PR body
id: determine_next_tag_from_pr
uses: climatepolicyradar/get-next-tag-from-pr-body@v2
with:
pr_body: "${{ env.PR_BODY }}"
pr_number: "${{ github.event.pull_request.number }}"

- name: Next tag found?
run: |
if [[ -z "${{ steps.determine_next_tag_from_pr.outputs.new_tag }}" ]]; then
exit 1;
fi
10 changes: 4 additions & 6 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI/CD

on:
push:
tags: ["v*"]
tags: [v*]
branches:
- main
pull_request:
Expand Down Expand Up @@ -37,11 +37,8 @@ jobs:
- name: Build docker compose
run: make build_dev

- name: Run Unit Tests
run: make unit_test

- name: Run Integration Tests
run: make integration_test
- name: Run Unit & Integration Tests
run: make test

build:
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
Expand Down Expand Up @@ -117,6 +114,7 @@ jobs:

release:
needs: tag
if: ${{ needs.tag.outputs.new_tag != 'Skip' }}
permissions:
contents: write
uses: climatepolicyradar/reusable-workflows/.github/workflows/release.yml@main
Expand Down
Loading