Skip to content

Commit

Permalink
onie-pr - initial commit
Browse files Browse the repository at this point in the history
This script uses hub to bring pull requests
in to a local checkout of ONIE.

Signed-off-by: Alex Doyle <[email protected]>
  • Loading branch information
ehdoyle committed Aug 13, 2022
1 parent c37b3e3 commit 70df5bb
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions contrib/release/onie-pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh

# Copyright 2022 Nivida Corporation
# Copyright 2015 Cumulus Networks, Inc.
# All rights reserved.
#

# Use the 'hub' command to integrate github pull requests

PR=$1
ONIE_GH_URL=https://github.com/opencomputeproject/onie/pull

URL="${ONIE_GH_URL}/$PR"

#
# /usr/local/bin/hub is where hub will be found if this is executing
# in an ONIE build container.
#
HUB_LOCS="$HOME/bin/hub /mnt/behemoth1/devtools/hub/hub /bulk/curt/bin/hub /usr/local/bin/hub"
for h in $HUB_LOCS ; do
if [ -x "$h" ] ; then
HUB="$h"
break
fi
done

[ -n "$HUB" ] || {
echo "ERROR: Unable to find hub binary."
echo "Are you in an ONIE build environment?"
exit 1
}

[ -x "$HUB" ] || {
echo "ERROR: Unable to execute hub program: $HUB"
exit 1
}

NON_MASTER_OK="${2:-no}"


# verify we're on the master branch
branch=$(git rev-parse --abbrev-ref HEAD)
[ "$branch" = "master" ] || {
echo "WARNING: Not on the master branch"
git status
[ "$NON_MASTER_OK" != "no" ] || exit 1
}

# pull in the PR
echo "Pulling in: $URL"
$HUB am -3 --signoff "$URL"

0 comments on commit 70df5bb

Please sign in to comment.