Skip to content

Commit

Permalink
Merge pull request #29 from stakater/AsfaMumtaz-patch-1
Browse files Browse the repository at this point in the history
Update fetch_params_github.py
  • Loading branch information
rasheedamir authored Sep 25, 2023
2 parents 0f09b7b + f3abd24 commit d078c12
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
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

0 comments on commit d078c12

Please sign in to comment.