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' repository: 'oceanprotocol/ocean.js'
path: 'ocean.js' path: 'ocean.js'
ref: ${{ github.event.pull_request.head.sha }} 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 - name: setup git config
run: | run: |
@ -216,7 +206,7 @@ jobs:
git config user.name "GitHub Actions Bot" git config user.name "GitHub Actions Bot"
git config user.email "<>" git config user.email "<>"
- name: Commit if there are changes - name: Create Guide & Commit if there are changes
run: npm run commit:guide run: npm run commit:guide

View File

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