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:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test_unit, test_integration, build, coverage]
|
||||
needs: [test_unit, test_integration]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
@ -216,14 +216,30 @@ jobs:
|
||||
git config user.name "GitHub Actions Bot"
|
||||
git config user.email "<>"
|
||||
|
||||
- name: commit
|
||||
- name: Commit if there are changes
|
||||
run: |
|
||||
# Stage the file, commit and push
|
||||
git status
|
||||
branch=${GITHUB_HEAD_REF#refs/heads/}
|
||||
git checkout -b ${branch}
|
||||
git status
|
||||
git add CodeExamples.md
|
||||
git commit -m "Updating CodeExamples.md" --untracked-files=no
|
||||
echo Pushing changes to branch: ${branch}
|
||||
git push origin HEAD:${branch} --force > /dev/null 2>&1
|
||||
# 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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user