-
Notifications
You must be signed in to change notification settings - Fork 5
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 #1 from mvidner/master
Added a new script; replaced github-secrets by ~/.netrc
- Loading branch information
Showing
4 changed files
with
49 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
json-* |
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,37 @@ | ||
#!/bin/bash | ||
# When recovering the broken svn-git migration, | ||
# we needed to temporarily disable the commit email notifications. | ||
|
||
# Stop on errors. | ||
set -e | ||
|
||
# Check that ~/.netrc knows github | ||
. github-secrets | ||
|
||
organization="yast" | ||
# Get the list from http://zq1.de/bernhard/yast-broken-list.txt | ||
repolist=`sed 's/^/yast-/' yast-broken-list.txt` | ||
|
||
for repo in $repolist | ||
do | ||
echo -n $repo... | ||
curl -f -s -n https://api.github.com/repos/${organization}/${repo}/hooks -o ${json}.list | ||
if [ $(grep '"id"' ${json}.list | wc -l) != 1 ]; then | ||
echo "$repo has more than one hook. fix manually" | ||
touch ${repo}.error | ||
continue | ||
fi | ||
ID=$(sed -n 's/.*"id": \([0-9]*\).*/\1/;T;p;q' ${json}.list) | ||
json=json-${repo} | ||
cat > ${json} << EOJSON | ||
{ | ||
"name": "email", | ||
"active": false, | ||
"config": { | ||
"address": "yast-commit@opensuse.org" | ||
} | ||
} | ||
EOJSON | ||
curl -f -s -n -X PATCH -d @${json} https://api.github.com/repos/${organization}/${repo}/hooks/$ID -o ${json}.result | ||
echo " OK" | ||
done |
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 |
---|---|---|
@@ -1,3 +1,10 @@ | ||
username="johndoe" | ||
password="yourpassword" | ||
|
||
# This file used to define the shell variables `username` and `password` | ||
# but then they would show up in output of `ps`, `bash -x`... | ||
# It is better to use `~/.netrc` which `curl -n` will use. | ||
if ! grep -qs api.github.com ~/.netrc; then | ||
echo "Set up your Github credentials first:" | ||
echo " : >> ~/.netrc" | ||
echo " chmod 600 ~/.netrc" | ||
echo " echo 'machine api.github.com login USER password PASSWORD' >> ~/.netrc" | ||
exit 1 | ||
fi |