Instead of using github API I want to make an auto generated/updated json file of this:
github repo api link
{
"sha": "asdfadsfasdfadf",
"url": "https://api.github.com/repos/user/repo/git/trees/asdfasdfadsf",
"tree": [
{
"path": ".gitattributes",
"mode": "100644",
"type": "blob",
"sha": "asdfasdfasdfadf",
"size": 2518,
"url": "https://api.github.com/repos/user/repo/git/blobs/asdfasdfadsf"
},
...
with the use of github actions if possible and generates a json output file like this in the repo:
files.json
{
"timestamp_created": "01-23-2023 12:34:35",
"timestamp_updated": "01-23-2023 13:53:23", // if someone made a merge
"files": [ // selected dir from github repo
{
"path": "Files/Sample.cs"
"name": "Sample Script"
},
]
}
...
I have no choice because the github api limit reach was a decent issue of my application that’s why this idea might work to use an auto generated json file from repo that contents all the files of a specific directory in the repository.
2
Answers
I already solved the problem by executing a C# Console Project inside of my repository through dotnet run command since I've noticed that actions can execute commands so I tried to use dotnet and it works.
In my C# code, after adding objects I printed it out as json string, and then this will out as json file base on the command
> gen.json
You can try this action to list all the files changed in a PR in json format.
Source: https://github.com/marketplace/actions/get-all-changed-files#get-all-removed-files-as-json