diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34a78e2..caa4703 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: # Calculates traffic and clones and stores in CSV file - name: Repository Traffic id: traffic - uses: ./ + uses: sangonzal/repository-traffic-action@0.1.1 env: TRAFFIC_ACTION_TOKEN: ${{ secrets.TRAFFIC_ACTION_TOKEN }} diff --git a/Dockerfile b/Dockerfile index b5acaaf..69f351e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,4 @@ COPY Pipfile.lock / RUN pip install 'pipenv==2018.11.26' RUN pipenv install --deploy --ignore-pipfile -ENTRYPOINT ["pipenv", "run", "python", "./main.py"] \ No newline at end of file +ENTRYPOINT ["pipenv", "run", "python", "/main.py"] \ No newline at end of file diff --git a/README.md b/README.md index 5306c53..82f2e5d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Repository Traffic GitHub Action -Github action that can be used to store repository traffic and clones past the default 2 week period. It pulls traffic and clones data from the GitHub API and stores it into a csv file, which can be commited to your repository or uploaded to storage elsewhere. +Github action that can be used to store repository traffic and clones past the default 2 week period. It pulls traffic and clones data from the GitHub API v3 and stores it into a csv file, which can be commited to your repository or uploaded elsewhere. # Usage @@ -23,7 +23,7 @@ Create a `workflow.yml` file and place in your `.github/workflows` folder. You c # Calculates traffic and clones and stores in CSV file - name: Repository Traffic id: traffic - uses: ./ + uses: sangonzal/repository-traffic-action@v0.1.1 env: TRAFFIC_ACTION_TOKEN: ${{ secrets.TRAFFIC_ACTION_TOKEN }} ``` @@ -52,7 +52,7 @@ jobs: # Calculates traffic and clones and stores in CSV file - name: GitHub traffic id: traffic - uses: ./ + uses: sangonzal/repository-traffic-action@v0.1.1 env: TRAFFIC_ACTION_TOKEN: ${{ secrets.TRAFFIC_ACTION_TOKEN }} @@ -63,8 +63,9 @@ jobs: author_name: Santiago Gonzalez message: "GitHub traffic" add: "./traffic/*" + ref: "traffic" # commits to branch "traffic" ``` -### Sample workflow that runs weekly and commits files to repository. +### Sample workflow that runs weekly and uploads files to S3. If you'd like to avoid commiting the data to the repository, you can use another action to upload elsewhere. For example, you could upload to S3 using the [S3 Sync action](https://github.com/marketplace/actions/s3-sync) . @@ -88,7 +89,7 @@ jobs: # Calculates traffic and clones and stores in CSV file - name: Repository Traffic id: traffic - uses: ./ + uses: sangonzal/repository-traffic-action@v0.1.1 env: TRAFFIC_ACTION_TOKEN: ${{ secrets.TRAFFIC_ACTION_TOKEN }} diff --git a/main.py b/main.py index a4c71a2..4624146 100644 --- a/main.py +++ b/main.py @@ -60,8 +60,10 @@ def main(): # Consider letting users configure plots # traffic_weekly = traffic_frame.resample("W", label="left").sum().tail(12) # clones_weekly = clones_frame.resample("W", label="left").sum().tail(12) - traffic_frame.tail(30).plot(ax=axes[0]) - clones_frame.tail(30).plot(ax=axes[1]) + if not traffic_frame.empty: + traffic_frame.tail(30).plot(ax=axes[0]) + if not clones_frame.empty: + clones_frame.tail(30).plot(ax=axes[1]) plt.savefig(plots_path)