Skip to content

Add badge for up-to-date verification #45

Add badge for up-to-date verification

Add badge for up-to-date verification #45

name: Verify latest commit in official implementation
on:
pull_request:
branches: [ "master" ]
schedule:
- cron: "15 6 * * *" #every day 06:15 UTC
jobs:
verify-official-commit:
runs-on: ubuntu-latest
env:
GIT_URL: "https://github.com/material-foundation/material-color-utilities.git"
GIT_DIR_NAME: "material-color-utilities"
GIT_BRANCH: "main"
EXPECTED_COMMIT: eeaf82b8
steps:
- name: Get the latest commit hash
id: latest_official
run: |
git clone ${{ env.GIT_URL }} \
--branch ${{ env.GIT_BRANCH }} \
--origin ${{ env.GIT_DIR_NAME }}
cd ${{ env.GIT_DIR_NAME }}
echo "Latest official commit: $(git rev-parse --short=8 --verify HEAD)"
echo "commit_hash=$(git rev-parse --short=8 --verify HEAD)" >> $GITHUB_OUTPUT
- name: Compare to expected commit hash
run: |
echo "Expected: ${{ env.EXPECTED_COMMIT }}"
echo "Got: ${{ steps.latest_official.outputs.commit_hash }}"
if [ "${{ steps.latest_official.outputs.commit_hash }}" = "${{ env.EXPECTED_COMMIT }}" ]; then
echo "Commit hashes match."
exit 0
else
echo "Commit hashes do not match."
echo "Regenerate test cases based on latest official commit (${{ steps.latest_official.outputs.commit_hash }}) and update this workflow file to acknowledge the updated official implementation."
exit 1
fi