For my discord.js bot I want a way to get the latest GitHub release date, but the repo is private on an organization and I want a simple way, maybe using child_process.exec could do that but I don't find anything on the Internet.
I just want the date, in timestamp or in a string.
You could use a call to the GitHub API release
GET /repos/{owner}/{repo}/releases/latest
# Example
https://api.github.com/repos/{owner}/{repo}/releases/lates
Then answer will include:
"created_at": "2013-02-27T19:35:32Z",
"published_at": "2013-02-27T19:35:32Z",
The publication date should be the one you want.
Related
GitHub's Actions feature recently started letting users generate badges, to showcase the status of their tests. For example, if I have a set of tests that run on my repo's dev branch from a file named .github/test_dev.yml, I can access that build's status by adding /badge.svg to the end of the test's URL.
https://github.com/<username>/<repo_name>/actions/workflows/test_dev.yml/badge.svg
That's great from the standpoint of keeping your project readme up to date with the status of the project, but the next logical step would be to also add a link to the badge that points to the latest testing outcome.
Unfortunately, even though you can access all the tests of a particular action as follows:
https://github.com/<username>/<repo_name>/actions/workflows/test_dev.yml
The test runs themselves seem to be behind a unique ID under actions/runs/.
https://github.com/<username>/<repo_name>/actions/runs/1234567890
Is there any way to construct a URL that just points to the latest test? Something like:
https://github.com/<username>/<repo_name>/actions/workflows/test_dev.yml?result=latest
I poked through GitHub's documentation, but even though there's some documentation surrounding the generation of those badge SVG's, I couldn't find anything about linking directly to the action that actually generated that SVG.
you can use this to get the id in a yaml file:
https://github.com/<username>/<repo_name>/actions/runs/${{ github.run_id }}
I have a service that request all our repositories then for each repository, i'm getting all the csproj and vbproj in the repository.
My problem is that it return 2 versions of the same file!
Ex:
A project has been created that way => MYPROJECT.csproj and commited,
then renamed to MyProject.csproj and commited.
But the CodeSearch Api is returning both file!
How can i know which one is the right one ?
Documentation doesn't seems to mention it or I'm not understanding which properties I need to send or which properties is telling me that it's an old file.
Documentation
https://learn.microsoft.com/en-us/rest/api/azure/devops/search/code%20search%20results/fetch%20code%20search%20results?view=azure-devops-rest-5.1
URL
https://almsearch.dev.azure.com/MyOrganisation/MyProject/_apis/search/codesearchresults?api-version=5.1-preview.1
BODY
{
'searchText': 'ext:csproj',
'includeFacets': false,
'$skip': 0,
'$top': 1000,
'filters': {
'Project': ['MyProject']
},
'$orderBy': [{
'field': 'filename',
'sortOrder': 'ASC'
}]
}
When I do the same research directly on DevOps, I see this flag over the old file
So there must be a way to tell if it's an old file!
How can I get it ?
I could reproduce this issue on my side. In Tfvc Repo, the code search result will return all versions of the file.
Based on my test, the difference between them is versions -> changeid.
Generally changeid is incremental, so you could judge the old and new versions according to the value of changeid. This is a workaround.
On the other hand, I will help you to report this issue on our Developer Community forum, and after confirmation by our engineer, this issue will be reported to the product team. The product team would provide the updates if they view it.
I got the same message (I renamed file using git mv command):
I got this message after committing renamed file and when I clicked on search button. However, when I refreshed page, warning goes away:
For me it looks like search on web based on some kind of locally cached indexes, but it is aware that some file was changed. Thus you won't be able to achieve this via REST API call.
The only other chatter I've found about a rename-repo operation is based on the 1.0 REST API, which stopped working a year or so ago.
I should be able to use this documentation, but so far no luck: I find the "request example" confusing.
The "Note:" clearly implies that it should be possible to rename a repository using the 2.0 API. ("Note: Changing the name of the repository will cause the location to be changed.")
But a PUT to 2.0/repositories/owner/repo with data {"full_name": "owner/newname"} doesn't seem to change the name. Evidently it does locate the right repository, because I get back JSON describing that repository, but still with the original name. The web UI finds the original name, does not find the new name.
I would just like a working example of the data body to PUT to the 2.0/repositories/owner/repo path to rename owner/repo. Thanks.
(n.b. I already know how to rename a repo using the web UI. I must rename 84 repositories and would rather not do it by hand.)
It appears that {"name": "newname"} works. Attempting to change "full_name" or "slug" does not. TIL...
I'm trying to figure out how to use the Github API to get the number of downloads of a release. I have a test repo called polymer-reptation under my username benlindsay with one tag, 1.0. A Github Developer page here says that to get the information on a single release I can use the command GET /repos/:owner/:repo/releases/:id. I can't figure out how to use that command though. I tried things like curl --user "benlindsay" https://api.github.com/repos/:benlindsay/:polymer-reptation/releases/:1.0 on the command line, the same thing without the colons, and typing similar things into hurl.it. They all just give me
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}
at best. Can someone show me to how to use this feature of the API? (an easier way to track downloads would be helpful as well if one exists)
You should use it without the colons, they are there to indicate stuff you should replace.
However, Listing all releases at https://api.github.com/repos/benlindsay/polymer-reptation/releases Returns an empty array... No releases My guess is the API hasn't caught up yet. If this doesn't resolve itself shortly, contact GitHub.
I'm currently using GitHub Milestones, to track Issues that I want included in a Release...
Now, that I want to push a new Release, I can't see anyway of linking Issues to a Release (or for that matter, Milestones to a Release).
I was expecting that I could use the GitHub's Releases as a Changelog, so that users could easily see what Issues/Enhancements were fixed/included in a release.
e.g. Version-1.123 contained fixes for Issues #111, #222 and #333.
Does this functionality exist?
N.B.
I couldn't find anything under the GitHub Developer API
Also, this is the first Release.
You can have markdown in the body field of the request.
POST /repos/:owner/:repo/releases
{
"tag_name": "v1.0.0",
"target_commitish": "master",
"name": "v1.0.0",
"body": "* Fixed #1 \r\n * Fixed #2 ",
"draft": false,
"prerelease": false
}
Will look like:
I guess that's what you want.