mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Add create:guide command
This commit is contained in:
parent
54c156e09d
commit
ac3f5f7375
26
.github/workflows/ci.yml
vendored
26
.github/workflows/ci.yml
vendored
@ -217,29 +217,7 @@ jobs:
|
|||||||
git config user.email "<>"
|
git config user.email "<>"
|
||||||
|
|
||||||
- name: Commit if there are changes
|
- name: Commit if there are changes
|
||||||
run: |
|
run: npm run commit:guide
|
||||||
# Check if the file has been changed
|
|
||||||
# Input file
|
|
||||||
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)
|
|
||||||
|
|
||||||
# Check if file older
|
|
||||||
if [ $TIMEDIFF -gt $OLDTIME ]; then
|
|
||||||
echo "CodeExamples.md file has not been changed"
|
|
||||||
else
|
|
||||||
echo "CodeExamples.md file has been changed. Committing changes"
|
|
||||||
# Stage the file, commit and push
|
|
||||||
git status
|
|
||||||
git add CodeExamples.md
|
|
||||||
git commit -m "Updating CodeExamples.md"
|
|
||||||
branch=${GITHUB_HEAD_REF#refs/heads/}
|
|
||||||
echo Pushing changes to branch: ${branch}
|
|
||||||
git push origin HEAD:${branch} --force > /dev/null 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@
|
|||||||
"test:compute": "npm run mocha -- 'test/integration/ComputeFlow.test.ts'",
|
"test:compute": "npm run mocha -- 'test/integration/ComputeFlow.test.ts'",
|
||||||
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
"test:integration:cover": "nyc --report-dir coverage/integration --no-clean npm run test:integration",
|
||||||
"create:guide": "chmod +x ./scripts/createCodeExamples.sh && ./scripts/createCodeExamples.sh",
|
"create:guide": "chmod +x ./scripts/createCodeExamples.sh && ./scripts/createCodeExamples.sh",
|
||||||
"create:guide:mac": "chmod +x ./scripts/createCodeExamples-mac.sh && ./scripts/createCodeExamples-mac.sh"
|
"create:guide:mac": "chmod +x ./scripts/createCodeExamples-mac.sh && ./scripts/createCodeExamples-mac.sh",
|
||||||
|
"commit:guide": "chmod +x scripts/commitChanges.sh && scripts/commitChanges.sh"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
23
scripts/commitChanges.sh
Executable file
23
scripts/commitChanges.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
# Check if the file has been changed
|
||||||
|
# Input file
|
||||||
|
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)
|
||||||
|
|
||||||
|
# Check if file older
|
||||||
|
if [ $TIMEDIFF -gt $OLDTIME ]; then
|
||||||
|
echo "CodeExamples.md file has not been changed"
|
||||||
|
else
|
||||||
|
echo "CodeExamples.md file has been changed. Committing changes"
|
||||||
|
# Stage the file, commit and push
|
||||||
|
git status
|
||||||
|
git add CodeExamples.md
|
||||||
|
git commit -m "Updating CodeExamples.md"
|
||||||
|
branch=${GITHUB_HEAD_REF#refs/heads/}
|
||||||
|
echo Pushing changes to branch: ${branch}
|
||||||
|
git push origin HEAD:${branch} --force
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user