Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

pre push hook

Jakob Kogler edited this pageJun 1, 2018 ·1 revision

When contributing to the project, I quite frequently made a few errors that should not happen:

  • Link toarticle.md pages instead ofarticle.html.
  • Forget to add a title.

The following script checks if any of the two errors occurred before push to the server, and stop the process with an error message if the script didn't finish successfully.Additionally it also runs all tests and stops if the push process if a test is not successful.

Just put the following code in thee-maxx-eng/.git/hooks/pre-push and give it execution permissions withchmod +x e-maxx-eng/.git/hooks/pre-push.

#!/bin/bash# Check for .md linksMATCHES=$(grep -E "\[.*\]\(.*\.md(#.*)?\)" src/*/*.md src/index.md)if [ ! -z "$MATCHES" ];then    echo "Links containing .md found:"    echo "$MATCHES"    exit 1fi# Check for <!--?title TITEL>MISSING=$(grep -L "<\!--?title" src/*/*.md)if [ ! -z "$MISSING" ];then    echo "Title missing in:"    echo "$MISSING"    exit 1fi# run testscd test./test.shSTATUS=$?if [ $STATUS -ne 0 ];then    exit 1fi

This script will also run automatically at Travis CI whenever somebody pushes to the project or creates a pull request.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp