| 1 |
#!/bin/bash -eu |
| 2 |
|
| 3 |
echo "##[section]Setting up git configuration" |
| 4 |
git config --global user.name "Azure on github.com/dials/data" |
| 5 |
git config --global user.email "[email protected]" |
| 6 |
git config credential.helper "store --file=.git/credentials" |
| 7 |
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials |
| 8 |
echo |
| 9 |
|
| 10 |
echo "##[section]Installing github cli" |
| 11 |
pushd .. >/dev/null |
| 12 |
wget -nv https://github.com/github/hub/releases/download/v2.6.0/hub-linux-amd64-2.6.0.tgz -O - | tar xz |
| 13 |
export PATH=$(pwd)/hub-linux-amd64-2.6.0/bin/:${PATH} |
| 14 |
popd >/dev/null |
| 15 |
hub --version |
| 16 |
echo |
| 17 |
|
| 18 |
echo "##[section]Open pull requests:" |
| 19 |
declare -A UPDATEBRANCHES |
| 20 |
for BRANCH in $(hub pr list -b master -f '%H%n'); do |
| 21 |
echo ${BRANCH} |
| 22 |
UPDATEBRANCHES[${BRANCH}]=1 |
| 23 |
done |
| 24 |
echo |
| 25 |
|
| 26 |
echo "##[section]Checking for required definition updates..." |
| 27 |
echo Base commit is ${BUILD_SOURCEVERSION} |
| 28 |
for DATASET in $(python -c "import dials_data.datasets as ddd; print('\n'.join(ddd.fileinfo_dirty))") |
| 29 |
do |
| 30 |
echo Checking ${DATASET} |
| 31 |
[ ${UPDATEBRANCHES[update-${DATASET}]+x} ] || { |
| 32 |
echo Creating/Updating branch ${DATASET} |
| 33 |
git checkout -b "update-${DATASET}" |
| 34 |
git reset --hard ${BUILD_SOURCEVERSION} |
| 35 |
git commit --allow-empty -m "Trigger update of dataset ${DATASET}" |
| 36 |
git push -f -u origin "update-${DATASET}" |
| 37 |
echo |
| 38 |
echo Generating pull request: |
| 39 |
hub pull-request -f -m "Update dataset ${DATASET} |
| 40 |
|
| 41 |
This is an automated pull request to trigger an update of the hash information on dataset \`${DATASET}\`. |
| 42 |
|
| 43 |
These pull requests normally consist of two commits: the first one is an empty commit that triggers the |
| 44 |
hash information update, and the second commit is the actual hash information update. Once both commits |
| 45 |
have appeared, the tests have passed, and you are happy with the results you can squash merge the PR. |
| 46 |
" |
| 47 |
} |
| 48 |
done |