fix(build): change commit conformance check

- action fails if the even is not of a supported type, only check for PR
This commit is contained in:
Arthur Meyre
2021-09-29 12:47:42 +02:00
parent 4ef0a13248
commit 456df69f0b

View File

@@ -28,6 +28,7 @@ env:
LATEST_IMAGE: ghcr.io/zama-ai/concretefhe-env:latest
BASE_IMAGE: ghcr.io/zama-ai/concretefhe-env
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
IS_PR: ${{ github.event_name == 'pull_request' }}
jobs:
build-preflight-docker:
@@ -50,8 +51,6 @@ jobs:
- name: Get changed files
if: ${{ (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) || github.event_name == 'pull_request' }}
id: files
env:
IS_PR: ${{ github.event_name == 'pull_request' }}
run: |
CURRENT_SHA="${{ github.sha }}"
if [[ "${IS_PR}" == "true" ]]; then
@@ -187,7 +186,7 @@ jobs:
make setup_env
- name: Check commits first line format
id: ccfl
if: ${{ steps.install-deps.outcome == 'success' && !cancelled() }}
if: ${{ env.IS_PR && steps.install-deps.outcome == 'success' && !cancelled() }}
uses: gsactions/commit-message-checker@f27f413dcf8ebcb469d2ce4ae4e45e131d105de6
with:
pattern: '^((feat|fix|chore|refactor|style|test|docs)(\(\w+\))?\:) .+$'
@@ -200,7 +199,7 @@ jobs:
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Check commits line length
id: ccll
if: ${{ steps.install-deps.outcome == 'success' && !cancelled() }}
if: ${{ env.IS_PR && steps.install-deps.outcome == 'success' && !cancelled() }}
uses: gsactions/commit-message-checker@f27f413dcf8ebcb469d2ce4ae4e45e131d105de6
with:
pattern: '(^.{0,74}$\r?\n?){0,20}'
@@ -210,6 +209,17 @@ jobs:
excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Commit conformance
id: commit-conformance
if: ${{ steps.install-deps.outcome == 'success' && !cancelled() }}
env:
CCFL_OK: ${{ (env.IS_PR && steps.ccfl.outcome == 'success') || steps.ccfl.outcome == 'skipped' }}
CCLL_OK: ${{ (env.IS_PR && steps.ccll.outcome == 'success') || steps.ccll.outcome == 'skipped' }}
run: |
if [[ "${CCFL_OK}" != "true" || "${CCLL_OK}" != "true" ]]; then
echo "Issues with commits. First line ok: ${CCFL_OK}. Line length ok: ${CCLL_OK}."
exit 1
fi
- name: Source code Conformance
id: cs
if: ${{ steps.install-deps.outcome == 'success' && !cancelled() }}
@@ -233,7 +243,7 @@ jobs:
id: conformance
if: ${{ always() && !cancelled() }}
env:
CONFORMANCE_STATUS: ${{ steps.ccfl.outcome == 'success' && steps.ccll.outcome == 'success' && steps.cs.outcome == 'success' && steps.cbd.outcome == 'success' }}
CONFORMANCE_STATUS: ${{ steps.commit-conformance.outcome == 'success' && steps.cs.outcome == 'success' && steps.cbd.outcome == 'success' }}
run: |
if [[ "${CONFORMANCE_STATUS}" != "true" ]]; then
echo "Conformance failed, check logs"