diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e38a45ce..2907e73d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 + +