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

Update fetch_params_github.py #29

Merged
merged 6 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ RUN cd /tmp && \
# install jinja2 cli
RUN pip3 install j2cli && \
echo "Installed jinja2 cli"

RUN pip3 install requests && \
echo "Installed requests package"

# install maven
ENV MAVEN_HOME /usr/lib/mvn
Expand Down Expand Up @@ -112,10 +115,6 @@ RUN wget https://github.com/yannh/kubeconform/releases/download/$KUBECONFORM/kub
kubeconform -v && \
echo "Installed kubeconform-"${KUBECONFORM}

# install locust ( https://docs.locust.io/en/stable )
RUN pip3 install locust && \
locust -V && \
echo "Installed locust"

# roxctl client
RUN curl -sL -o /usr/local/bin/roxctl https://mirror.openshift.com/pub/rhacs/assets/${ROX_VERSION}/bin/Linux/roxctl && \
Expand Down
12 changes: 10 additions & 2 deletions scripts/python/fetch-params/fetch_params_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,24 @@ def fetch_params_github(provider, username, password, hash, workspace, repositor
if provider == "github":
url = f"https://api.github.com/repos/{workspace}/{repository}/pulls"
print(url)
pull_requests = send_api_request (url, password)
pull_requests = send_api_request_github(url, password)
found = False
if pull_requests:
for pr in pull_requests:
if found == True:
break
pull_request_id = pr['number']
url = f"https://api.github.com/repos/{workspace}/{repository}/pulls/{pull_request_id}/commits"
commits = send_api_request(url,"", password, "github")
commits = send_api_request_github(url, password)
if commits:
for commit in commits:
print(f"Commit SHA: {commit['sha']}")
if commit['sha'] == hash:
print(f"Found hash in PR {pull_request_id}")
found = True
return pull_request_id
break
else:
return None
else:
return None
Loading