Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRT-1107: move neverstable cron script here for GH app auth #2188

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions scripts/cronjob-update-neverstable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
set -x
set -o errexit
set -o pipefail

# This repo is assumed checked out in current directory
git checkout -b update

# Generate and push mapping
OUTPUT=$(./scripts/update-neverstable.sh)

if git diff --quiet
then
echo "No changes."
exit 0
fi

# get token with write ability (after slow work is done; do not give the token a chance to expire)
keyfile="${GHAPP_KEYFILE:-/secrets/ghapp/private.key}"
set +x
trt_token=`gh-token generate --app-id 1046118 --key "$keyfile" --installation-id 57361690 --token-only` # 57361690 = openshift-trt
git remote add openshift-trt "https://oauth2:${trt_token}@github.com/openshift-trt/sippy.git"
set -x

git commit -a -m "Update never-stable"
git push openshift-trt update --force

pr-creator -org openshift -repo sippy -source openshift-trt:update -branch master \
-github-app-private-key-path "${keyfile}" -github-app-id 1046118 \
-body "**Note: PLEASE REVIEW CHANGES BEFORE MERGING**<br><br>$OUTPUT" \
-title "Automated - Update never-stable" \
-confirm