diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 46ccb8e..67cd067 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -72,6 +72,8 @@ jobs: if: github.event_name == 'release' steps: - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_ACTION_ACCESS_TOKEN }} - name: Set up Python uses: actions/setup-python@v4 with: @@ -87,3 +89,31 @@ jobs: with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} + - name: Update CHANGELOG.md + run: | + TMP_FILE=$(mktemp) + + RELEASE_VERSION=$(jq -r '.release' .release.json) + RELEASE_DATE=`date +'%dth %B %Y' | sed -E 's/^0//;s/^([2,3]?)1th/\11st/;s/^([2]?)2th/\12nd/;s/^([2]?)3th/\13rd/'` + + SPEC_COMMIT_SHA=$(jq -r '.source.short_sha' .release.json) + SPEC_COMMIT_URL=$(jq -r '.source.repo_url + "/commit/" + .source.long_sha' .release.json) + SPEC_RELEASE_VERSION=$(jq -r '.source.version' .release.json) + SPEC_RELEASE_URL=$(jq -r '.source.repo_url + "/releases/tag/" + .source.version' .release.json) + + echo -e "# Changelog\n\n## $RELEASE_VERSION $RELEASE_DATE\n\n" >| $TMP_FILE + echo -en "${{ github.event.release.body }}\nBased on Onfido OpenAPI spec " >> $TMP_FILE + + if [ -z $SPEC_RELEASE_VERSION ]; then + echo "up to commit [$SPEC_COMMIT_SHA](${SPEC_COMMIT_URL})." >> $TMP_FILE + else + echo "version [$SPEC_RELEASE_VERSION](${SPEC_RELEASE_URL})." >> $TMP_FILE + fi + + grep -v "^# Changelog" CHANGELOG.md >> $TMP_FILE + mv $TMP_FILE CHANGELOG.md + + git config user.name "GitHub Actions Bot" + git config user.email "<>" + git commit -m "Update CHANGELOG.md after library release" CHANGELOG.md + git push diff --git a/CHANGELOG.md b/CHANGELOG.md index eece340..b1aae58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,5 @@ # Changelog -## v3.0.0 14th Jun 2024 - -- Make library auto-generated and based on [Onfido OpenAPI spec](https://github.com/onfido/onfido-openapi-spec) -- Refresh library up to commit: [62dc554](https://github.com/onfido/onfido-openapi-spec/commit/62dc5541a4a51e8de313fc99fb3dec496033a23e) - ## v2.10.0 24th November 2023 - Added core methods for [WorkflowRuns](https://documentation.onfido.com/#workflow-runs) diff --git a/tests/test_report_schemas.py b/tests/test_report_schemas.py index e0714b8..0796aaf 100644 --- a/tests/test_report_schemas.py +++ b/tests/test_report_schemas.py @@ -68,3 +68,4 @@ def test_schema_of_facial_similarity_report_id_valid( onfido_api.find_report, [facial_similarity_report_id], ReportStatus.COMPLETE ) assert isinstance(facial_similarity_report, FacialSimilarityPhotoReport) + assert facial_similarity_report.properties.score is None