-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from openconfig/support-forks
Add support for PRs created from forks
- Loading branch information
Showing
4 changed files
with
47 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,21 +24,25 @@ find $_MODEL_ROOT -name '*.yang' > $RESULTSDIR/all-non-empty-files.txt 2>> $OUTF | |
# This requires the check logic within post_results to be changed. | ||
# I'm delaying this because it remains to be seen whether goyang can be | ||
# refactored so we don't need do this inter-process communication via files. | ||
if bash $RESULTSDIR/script.sh > $OUTFILE 2>> $FAILFILE; then | ||
if bash $RESULTSDIR/script.sh >> $OUTFILE 2>> $FAILFILE; then | ||
# Delete fail file if it's empty and the script passed. | ||
find $FAILFILE -size 0 -delete | ||
fi | ||
cat $RESULTSDIR/*.pr-file-parse-log > $RESULTSDIR/pr-file-parse-log 2>> $OUTFILE | ||
|
||
# changed-files.txt | ||
REPODIR=$RESULTSDIR/base_repo | ||
git clone -b $BRANCH_NAME "[email protected]:$_REPO_SLUG.git" $REPODIR | ||
git clone "[email protected]:$_REPO_SLUG.git" $REPODIR | ||
cd $REPODIR | ||
BASE_COMMIT=$(git merge-base $COMMIT_SHA origin/master) | ||
PRBRANCH=gcb-ci-remote-repo-long-name-to-avoid-conflict | ||
# fetching the PR directly from GitHub handles both normal PRs as well as forks. | ||
git fetch origin pull/$_PR_NUMBER/head:$PRBRANCH | ||
git checkout $PRBRANCH | ||
BASE_COMMIT=$(git merge-base $PRBRANCH origin/master) | ||
git diff --name-only $BASE_COMMIT | grep -E '.*\.yang$' > $RESULTSDIR/changed-files.txt 2>> $OUTFILE | ||
|
||
# master-file-parse-log | ||
git checkout $BASE_COMMIT &> $OUTFILE | ||
git checkout $BASE_COMMIT &>> $OUTFILE | ||
if find $REPODIR -name '*.yang' | xargs $GOPATH/bin/ocversion -p $REPODIR > $RESULTSDIR/master-file-parse-log 2>> $FAILFILE; then | ||
# Delete fail file if it's empty and the script passed. | ||
find $FAILFILE -size 0 -delete | ||
|