mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Only commiting if there are changes
This commit is contained in:
parent
608d64c259
commit
98155fa154
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
@ -186,7 +186,7 @@ jobs:
|
|||||||
|
|
||||||
create_guide:
|
create_guide:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [lint, test_unit, test_integration, build, coverage]
|
needs: [test_unit, test_integration]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
@ -216,14 +216,30 @@ 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
|
- name: Commit if there are changes
|
||||||
run: |
|
run: |
|
||||||
# Stage the file, commit and push
|
# Check if the file has been changed
|
||||||
git status
|
# Input file
|
||||||
branch=${GITHUB_HEAD_REF#refs/heads/}
|
FILE=CodeExamples.md
|
||||||
git checkout -b ${branch}
|
# Timeframe for the comparison
|
||||||
git status
|
OLDTIME=60
|
||||||
git add CodeExamples.md
|
# Get current and file times
|
||||||
git commit -m "Updating CodeExamples.md" --untracked-files=no
|
CURTIME=$(date +%s)
|
||||||
echo Pushing changes to branch: ${branch}
|
FILETIME=$(stat $FILE -c %Y)
|
||||||
git push origin HEAD:${branch} --force > /dev/null 2>&1
|
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
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user