Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
7713fa87
Commit
7713fa87
authored
10 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
travis: check PRs if they need squashing or depend on other PRs
parent
50ec8d10
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.travis.yml
+1
-0
1 addition, 0 deletions
.travis.yml
dist/tools/pr_check/README.md
+18
-0
18 additions, 0 deletions
dist/tools/pr_check/README.md
dist/tools/pr_check/pr_check.sh
+67
-0
67 additions, 0 deletions
dist/tools/pr_check/pr_check.sh
with
86 additions
and
0 deletions
.travis.yml
+
1
−
0
View file @
7713fa87
...
...
@@ -59,6 +59,7 @@ script:
-
make -C ./tests/unittests all test BOARD=qemu-i386 || exit
-
./dist/tools/compile_test/compile_test.py
-
./dist/tools/pr_check/pr_check.sh riot/master
notifications
:
email
:
false
This diff is collapsed.
Click to expand it.
dist/tools/pr_check/README.md
0 → 100644
+
18
−
0
View file @
7713fa87
# About
This script checks if a Pull Request needs squashing or if it is waiting for
another Pull Request.
# Usage
```
bash
./pr_check.sh
[
<master branch>]
```
The optional
`<master branch>`
parameter refers to the branch the pull request's
branch branched from. The script will output all commits marked as squashable
from
`HEAD`
to the merge-base with
`<master branch>`
. The default for
`<master branch>`
is
`master`
.
A commit is marked as squashable if it contains the keywords SQUASH or FIX
(case insensitive) within the first five characters of it's subject title.
This diff is collapsed.
Click to expand it.
dist/tools/pr_check/pr_check.sh
0 → 100755
+
67
−
0
View file @
7713fa87
#! /bin/bash
#
# Copyright (C) 2014 Martin Lenders <mlenders@inf.fu-berlin.de>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
#
EXIT_CODE
=
0
GITHUB_API_HOST
=
"https://api.github.com"
GITHUB_REPO
=
"RIOT-OS/RIOT"
if
which wget &> /dev/null
;
then
GET
=
"wget -O -"
elif
which curl &> /dev/null
;
then
GET
=
"curl"
else
echo
"Script needs wget or curl"
>
&2
exit
2
fi
LABELS_JSON
=
$(
${
GET
}
"
${
GITHUB_API_HOST
}
/repos/
${
GITHUB_REPO
}
/issues/
${
TRAVIS_PULL_REQUEST
}
/labels"
2> /dev/null
)
if
tput colors &> /dev/null
&&
[
$(
tput colors
)
-ge
8
]
;
then
CERROR
=
"
\e
[1;31m"
CRESET
=
"
\e
[0m"
else
CERROR
=
CRESET
=
fi
check_gh_label
()
{
LABEL
=
"
${
1
}
"
echo
"
${
LABELS_JSON
}
"
|
grep
-q
"
${
LABEL
}
"
return
$?
}
if
[[
${#}
-eq
1
]]
;
then
RIOT_MASTER
=
"
${
1
}
"
else
RIOT_MASTER
=
"master"
fi
SQUASH_COMMITS
=
"
$(
git log
$(
git merge-base HEAD
"
${
RIOT_MASTER
}
"
)
...HEAD
--pretty
=
format:
"
\t
%C(auto)%h %s%Creset"
\
-i
--grep
"^.
\{
0,2
\}
SQUASH"
--grep
"^.
\{
0,2
\}
FIX"
)
"
if
[
-n
"
${
SQUASH_COMMITS
}
"
]
;
then
echo
-e
"
${
CERROR
}
Pull request needs squashing:
${
CRESET
}
"
1>&2
echo
-e
"
${
SQUASH_COMMITS
}
"
EXIT_CODE
=
1
fi
if
[
-n
"
$TRAVIS_PULL_REQUEST
"
]
;
then
if
check_gh_label
"NEEDS SQUASHING"
;
then
echo
-e
"
${
CERROR
}
Pull request needs squashing according to its labels
${
CRESET
}
"
EXIT_CODE
=
1
fi
if
check_gh_label
"Waiting For Other PR"
;
then
echo
-e
"
${
CERROR
}
Pull request is waiting for another pull request according to its labels
${
CRESET
}
"
EXIT_CODE
=
1
fi
fi
exit
${
EXIT_CODE
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment