diff --git a/.github/workflows/update-from-mds.yml b/.github/workflows/update-from-mds.yml index 46be868..857574d 100644 --- a/.github/workflows/update-from-mds.yml +++ b/.github/workflows/update-from-mds.yml @@ -28,6 +28,7 @@ jobs: with: fail-on-error: false script: | + import os import requests import base64 import json @@ -43,7 +44,15 @@ jobs: mds_bytes = base64.b64decode(jwt_payload) mds_strings = mds_bytes.decode('utf-8') mds_data = json.loads(mds_strings) - + + # Build commit msg and export to environment variable + mds_number = mds_data['no'] + mds_next = mds_data['nextUpdate'] + commit_msg=f'COMMIT_MSG=from MDS file version {mds_number}, next update expected {mds_next}.' + env_file = os.getenv('GITHUB_ENV') + with open(env_file, "a") as myfile: + myfile.write(commit_msg) + # Extract FIDO2 statements with non-null aaguid and required properties fido2_statements = [ entry['metadataStatement'] @@ -70,14 +79,11 @@ jobs: # Write combined result to file with open('combined_aaguid.json', 'w') as output_file: json.dump(result, output_file) - - name: Commit files + - name: Commit files and push run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add -A - git commit -m "bot: Update file" -a - - name: Push changes - uses: ad-m/github-push-action@v0.6.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: main \ No newline at end of file + timestamp=$(date -u) + git commit -m "bot: Updated ${timestamp}, ${{ env.COMMIT_MSG }}" -a || exit 0 + git push