forked from solana-labs/solana
-
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.
- Loading branch information
Showing
3 changed files
with
152 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Check if files in the commit range match a regex | ||
# | ||
|
||
( | ||
set -x | ||
git diff --name-only $TRAVIS_COMMIT_RANGE | ||
) | ||
|
||
for file in $(git diff --name-only $TRAVIS_COMMIT_RANGE); do | ||
if [[ $file =~ ^"$1" ]]; then | ||
exit 0 | ||
fi | ||
done | ||
|
||
echo "No modifications to $1" | ||
exit 1 |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Exports subdirectories into their own github repositories | ||
# | ||
# Careful! | ||
# | ||
|
||
set -e | ||
if [[ -z $GITHUB_TOKEN ]]; then | ||
echo GITHUB_TOKEN not defined | ||
exit 1 | ||
fi | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
pip3 install git-filter-repo | ||
|
||
declare subdir=$1 | ||
declare repo_name=$2 | ||
|
||
[[ -n $subdir ]] || { | ||
echo "Error: subdir not specified" | ||
exit 1 | ||
} | ||
[[ -n $repo_name ]] || { | ||
echo "Error: repo_name not specified" | ||
exit 1 | ||
} | ||
|
||
|
||
if ! .travis/affects.sh "^$subdir/"; then | ||
echo "No changes to $subdir" | ||
exit 0 | ||
fi | ||
|
||
echo "Exporting $subdir" | ||
|
||
set -x | ||
rm -rf .github_export/"$repo_name" | ||
git clone https://${GITHUB_TOKEN}@github.com/solana-labs/"$repo_name" .github_export/"$repo_name" | ||
|
||
# TODO: Try using a `--refs $TRAVIS_COMMIT_RANGE` to speed up the filtering | ||
git filter-repo --subdirectory-filter "$subdir" --target .github_export/"$repo_name" | ||
|
||
git -C .github_export/"$repo_name" push https://${GITHUB_TOKEN}@github.com/solana-labs/"$repo_name" | ||
|