1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

comparing the checksum of the CodeExamples.md file to see if it has been changed before commiting

This commit is contained in:
Jamie Hewitt 2022-05-31 18:06:35 +01:00
parent 3c05cc447e
commit 3a4da10c08
2 changed files with 8 additions and 20 deletions

View File

@ -199,16 +199,6 @@ jobs:
repository: 'oceanprotocol/ocean.js'
path: 'ocean.js'
ref: ${{ github.event.pull_request.head.sha }}
- name: Create code examples file
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-lint-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-lint-${{ env.cache-name }}-
- run: npm run create:guide
- name: setup git config
run: |
@ -216,7 +206,7 @@ jobs:
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Commit if there are changes
- name: Create Guide & Commit if there are changes
run: npm run commit:guide

View File

@ -1,14 +1,12 @@
# Check if the CodeExamples.md file has been changed
FILE=CodeExamples.md
# Timeframe for the comparison
OLDTIME=60
# Get current and file times
CURTIME=$(date +%s)
FILETIME=$(stat $FILE -c %Y)
TIMEDIFF=$(expr $CURTIME - $FILETIME)
original=$(md5sum CodeExamples.md)
echo $original
npm run create:guide
new=$(md5sum CodeExamples.md)
echo $new
# Check if file older
if [ $TIMEDIFF -gt $OLDTIME ]; then
# Check if file has changed
if [ "$new" = "$original" ]; then
echo "CodeExamples.md file has not been changed"
else
echo "CodeExamples.md file has been changed. Committing changes"