| 1 |
|
| 2 |
|
| 3 |
name: Push tip to trybot |
| 4 |
"on": |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- main |
| 8 |
concurrency: push_tip_to_trybot |
| 9 |
jobs: |
| 10 |
push: |
| 11 |
runs-on: ubuntu-22.04 |
| 12 |
defaults: |
| 13 |
run: |
| 14 |
shell: bash |
| 15 |
if: ${{github.repository == 'cue-labs/oci'}} |
| 16 |
steps: |
| 17 |
- name: Write netrc file for porcuepine Gerrithub |
| 18 |
run: |- |
| 19 |
cat <<EOD > ~/.netrc |
| 20 |
machine review.gerrithub.io |
| 21 |
login porcuepine |
| 22 |
password ${{ secrets.PORCUEPINE_GERRITHUB_PASSWORD }} |
| 23 |
EOD |
| 24 |
chmod 600 ~/.netrc |
| 25 |
- name: Push tip to trybot |
| 26 |
run: |- |
| 27 |
mkdir tmpgit |
| 28 |
cd tmpgit |
| 29 |
git init -b initialbranch |
| 30 |
git config user.name porcuepine |
| 31 |
git config user.email [email protected] |
| 32 |
git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n porcuepine:${{ secrets.PORCUEPINE_GITHUB_PAT }} | base64)" |
| 33 |
git remote add origin https://review.gerrithub.io/a/cue-labs/oci |
| 34 |
git remote add trybot https://github.com/cue-labs/oci-trybot |
| 35 |
|
| 36 |
git fetch origin "${{ github.ref }}" |
| 37 |
|
| 38 |
success=false |
| 39 |
for try in {1..20}; do |
| 40 |
echo "Push to trybot try $try" |
| 41 |
if git push -f trybot "FETCH_HEAD:${{ github.ref }}"; then |
| 42 |
success=true |
| 43 |
break |
| 44 |
fi |
| 45 |
sleep 1 |
| 46 |
done |
| 47 |
if ! $success; then |
| 48 |
echo "Giving up" |
| 49 |
exit 1 |
| 50 |
fi |