sangonzal / repository-traffic-action Goto Github PK
View Code? Open in Web Editor NEWGitHub action to save GitHub repository insights past the default 2 week period
License: MIT License
GitHub action to save GitHub repository insights past the default 2 week period
License: MIT License
Hello,
I have been using this workflow for about 2 years with no issues but the jobs suddenly stopped running in November'23. When I look at the error returned in the job, I see "Resource protected by organization SAML enforcement".
What I have done so far:
ย
Traceback (most recent call last): File "/main.py", line 57, in <module> main() File "/main.py", line 25, in main views_frame = repo_stats.get_views(views_path) File "/repostats.py", line 9, in get_views views = self.repo.get_views_traffic() File "/root/-x-v5uFv0/lib/python3.8/site-packages/github/Repository.py", line [19](https://github.com/Azure/Azure-Network-Security/actions/runs/7398228726/job/20126949735#step:4:20)86, in get_views_traffic headers, data = self._requester.requestJsonAndCheck( File "/root/-x-v5uFv0/lib/python3.8/site-packages/github/Requester.py", line 353, in requestJsonAndCheck return self.__check( File "/root/-x-v5uFv0/lib/python3.8/site-packages/github/Requester.py", line 378, in __check raise self.__createException(status, responseHeaders, output) github.GithubException.GithubException: 403 **{"message": "Must have push access to repository", "documentation_url": "https://docs.github.com/rest/metrics/traffic#get-page-views"}
**
Thanks for this very handy action. The problem I encountered is that the action will fail for anyone forking the repo since it relies on a PAT. Any ideas for a workaround?
I believe the Github API has changed. As a result I get this error now when running the workflow:
Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/reference/repos#get-page-views"
https://docs.github.com/en/rest/reference/repository-metrics#get-page-views
Hi there,
Thanks so much for this very useful tool. I would like to use the latest version, which looking at the code seems much improved. However, setting @afe0206f766a8c1b5350977a377bdbcc6ab8072b instead of @v0.1.4 results in the error:
Traceback (most recent call last):
File "/main.py", line 3, in <module>
from repostats import RepoStats
ModuleNotFoundError: No module named 'repostats'
I wonder if it is just a matter of copying the repostat.py into the docker container, which seems to be missing in the Dockerfile.
Hi Santiago
First of, this looks really good, great work.
I want to know if it is possible to set up a workflow that will get the traffic data from repo A and store it in repo B, under a specific folder/filename.csv file.
My use case is a bunch of repos that I all want to collect stats for, but I would like to store them in a private repo.
Thanks, Egil
Can the action report the number of views and unique visitors too since these attributes are also restricted to the 2 weeks limitation
Hi - starting last week I keep getting this error reported below.
I tried to re-create my token but I have not been able to sort the problem.
Any idea? Can you help?
thanks!
Run sangonzal/[email protected]
with:
branch: dev
env:
TRAFFIC_ACTION_TOKEN: ***
/usr/bin/docker run --name a33c1a32ba7c2905941738f2b48262d66ba50_246ae8 --label 8a33c1 --workdir /github/workspace --rm -e TRAFFIC_ACTION_TOKEN -e INPUT_BRANCH -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/MMM-covid19/MMM-covid19":"/github/workspace" 8a33c1:a32ba7c2905941738f2b48262d66ba50
Repository name: 0m4r/_[REDACTED]_
Traceback (most recent call last):
File "/main.py", line 9, in <module>
repo = github.get_repo(repo_name)
File "/root/-x-v5uFv0/lib/python3.8/site-packages/github/MainClass.py", line 345, in get_repo
headers, data = self.__requester.requestJsonAndCheck(
File "/root/-x-v5uFv0/lib/python3.8/site-packages/github/Requester.py", line 315, in requestJsonAndCheck
return self.__check(
File "/root/-x-v5uFv0/lib/python3.8/site-packages/github/Requester.py", line 340, in __check
raise self.__createException(status, responseHeaders, output)
github.GithubException.BadCredentialsException: 401 {"message": "Bad credentials", "documentation_url": "https://docs.github.com/rest"}
dear @sangonzal your action looks simple and easy and well explained, great work
where is the data now?
When the action runs, are the previous files in the ./traffic
directory overwritten?
First, thank you for this action - very useful!
In the example this action runs every week. I'm assuming that every time it runs is just overwrites the data it had from the previous week? Or does it work as a log and keeps adding rows to the existing CSV files?
If it overwrites the files, it would be good to mention that in the README. Also, a quick first improvement could be to timestamp each file, so that every week it would generate a file which could be collated into a master.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.