|
27 | 27 | runs-on: ubuntu-latest
|
28 | 28 | steps:
|
29 | 29 | - name: Check out head
|
30 |
| - uses: actions/checkout@v1 |
31 |
| - with: |
32 |
| - fetch-depth: 0 |
33 |
| - - name: Check git history |
34 |
| - run: | |
35 |
| - if git merge-base --is-ancestor $GITHUB_SHA origin/develop; then |
36 |
| - echo "DEVELOP_COMMIT_HISTORY=$GITHUB_SHA" >> $GITHUB_ENV |
37 |
| - fi |
38 |
| - - name: Check for version change |
39 |
| - id: changed-version-file |
40 |
| - uses: tj-actions/[email protected] |
41 |
| - with: |
42 |
| - files: | |
43 |
| - VERSION |
44 |
| - - name: Fail if version changed |
45 |
| - if: ${{ steps.changed-version-file.outputs.any_changed == 'true' && github.sha != env.DEVELOP_COMMIT_HISTORY }} |
46 |
| - run: | |
47 |
| - echo "Version changes are prohibited in pull requests." |
48 |
| - exit 10 |
49 |
| - - name: Read head version |
50 |
| - if: ${{ github.sha != env.DEVELOP_COMMIT_HISTORY }} |
51 |
| - run: | |
52 |
| - HEAD_VERSION="$(cat ./VERSION)" |
53 |
| - echo "HEAD_VERSION=$HEAD_VERSION" >> $GITHUB_ENV |
54 |
| - - name: Validate changelog entry |
55 |
| - if: ${{ github.sha != env.DEVELOP_COMMIT_HISTORY }} |
56 |
| - run: | |
57 |
| - git diff --name-only origin/develop | grep CHANGELOG |
58 |
| - unreleased_header_line=8 |
59 |
| - if [[ $(sed "${unreleased_header_line}q;d" CHANGELOG.md) != "## [UNRELEASED]" ]] ; then |
60 |
| - echo 'Removing the [UNRELEASED] header is prohibited in pull requests.' |
61 |
| - exit 4 |
62 |
| - fi |
63 |
| - latest_release=$(sed -n "/\[[0-9]\+\.[0-9]\+\.[0-9]\+\]/=" CHANGELOG.md | head -n 1) |
64 |
| - IFS='[]' read -ra changelog_version <<< $(sed "${latest_release}q;d" CHANGELOG.md) |
65 |
| - if [[ "${changelog_version[1]}" != $HEAD_VERSION ]] ; then |
66 |
| - echo 'The most recent CHANGELOG release does not match the VERSION'. |
67 |
| - exit 3 |
68 |
| - fi |
69 |
| - #Check that the lines in the diff are between unreleased_header_line and latest_release |
70 |
| - IFS='@-+,' read -ra LINES <<< "$(git diff develop -- CHANGELOG.md | sed '5q;d')" |
71 |
| - start_head="$(( LINES[5] + 3 ))" |
72 |
| - lines_head="$(( LINES[6] - 6 ))" |
73 |
| - if [[ $start_head -lt $unreleased_header_line ]] || |
74 |
| - [[ $((start_head + lines_head)) -gt $latest_release ]] ; then |
75 |
| - echo 'Changes outside the UNRELEASED block are prohibited in pull requests.' |
76 |
| - exit 6 |
77 |
| - fi |
| 30 | + uses: actions/checkout@v3 |
| 31 | + - name: Validate Version |
| 32 | + uses: AgnostiqHQ/covalent/.github/actions/version@develop |
0 commit comments