Skip to content

Commit

Permalink
Add repostory protability
Browse files Browse the repository at this point in the history
Removed hardcoded repository name. Now the repository can be placed in any account and should work without making any major changes apart from documentation
  • Loading branch information
vandanrohatgi committed Aug 28, 2022
1 parent 13b5c1b commit 699448a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 130 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/scheduled_job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ on:
- cron: "0 12 * * SUN"
workflow_dispatch:

env:
REPO_OWNER: ${{ github.repository_owner }}

jobs:

Project-runner:
strategy:
matrix:
Expand Down Expand Up @@ -93,7 +95,7 @@ jobs:
- name: fetch repo
uses: actions/checkout@v3
with:
repository: vandanrohatgi/Seaweed-Reports
repository: ${{ env.REPO_OWNER }}/Seaweed-Reports
token: ${{ secrets.GAT }}

- name: set env
Expand Down Expand Up @@ -127,7 +129,7 @@ jobs:
- name: fetch repo
uses: actions/checkout@v3
with:
repository: vandanrohatgi/Seaweed-Reports
repository: ${{ env.REPO_OWNER }}/Seaweed-Reports
token: ${{ secrets.GAT }}

- name: set target directory
Expand Down
119 changes: 0 additions & 119 deletions .github/workflows/test_run.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project Seaweed

[![Tests](https://github.com/vandanrohatgi/Project-Seaweed/workflows/Tests/badge.svg)](https://github.com/vandanrohatgi/Project-Seaweed/actions?workflow=Tests)
[![Tests](https://github.com/coreruleset/Project-Seaweed/workflows/Tests/badge.svg)](https://github.com/coreruleset/Project-Seaweed/actions?workflow=Tests)

## GSoC meet #11 Summary

Expand Down Expand Up @@ -45,7 +45,7 @@ This project does not provide the functionality to fetch the logs from CRS conta

1. **Clone the repository**

`git clone https://github.com/vandanrohatgi/Project-Seaweed.git`
`git clone https://github.com/coreruleset/Project-Seaweed.git`

2. **Install poetry**

Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Installation

1. **Clone the repository**

`git clone https://github.com/vandanrohatgi/Project-Seaweed.git`
`git clone https://github.com/coreruleset/Project-Seaweed.git`

2. **Install poetry**

Expand Down
12 changes: 7 additions & 5 deletions src/project_seaweed/report_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import requests
import difflib
import os

repo_owner=os.environ.get("REPO_OWNER", default='coreruleset')

file_url: str = "https://raw.githubusercontent.com/vandanrohatgi/Seaweed-Reports/main/{}/{}Artifact/{}Analysis.yaml"
file_url: str = "https://raw.githubusercontent.com/{}/Seaweed-Reports/main/{}/{}Artifact/{}Analysis.yaml"
latest_scan: str = (
"https://raw.githubusercontent.com/vandanrohatgi/Seaweed-Reports/main/latest.txt"
"https://raw.githubusercontent.com/{}/Seaweed-Reports/main/latest.txt"
)


Expand All @@ -16,7 +18,7 @@ def fetch_latest_test() -> str:
Returns:
str: directory where the latest test results are stored
"""
response: str = requests.get(latest_scan)
response: str = requests.get(latest_scan.format(repo_owner))
dir: str = response.text.strip()
return dir

Expand All @@ -34,8 +36,8 @@ def analyze(date1: str = "", date2: str = "", tag: str = "") -> None:
if date1 == "latest":
date1 = fetch_latest_test()

response1: str = requests.get(file_url.format(date1, tag, tag)).text
response2: str = requests.get(file_url.format(date2, tag, tag)).text
response1: str = requests.get(file_url.format(repo_owner,date1, tag, tag)).text
response2: str = requests.get(file_url.format(repo_owner,date2, tag, tag)).text

for line in difflib.unified_diff(
response2.split("\n"),
Expand Down

0 comments on commit 699448a

Please sign in to comment.