Find date of newest release in github - github

I am trying to write a script that will get the most recent release for a specific repository in github, and then display the commits since that release was created.
I know I can get the commits using this:
https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
And I would like to get the published_at date of the most recent release so I can use it to create a request to the github API like this:
curl https://api.github.com/repos/RepoOwner/MyRepo/commits?since=2015-01-01T00:00:00Z
Where 2015-01-01T00:00:00Z happens to be the published_at date of the most recent release. I know I can get a list of releases like this:
https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
My plan was to get the list of releases in descending order by date, and then just examine the first one to figure out what the date of the release was. But sorting doesn't seem to work. Specifying that the results should be sorted by sort=published_at with either asc or desc for order seem to have the same results (https://api.github.com/repos/ReporOwner/myrepo/releases?sort=published_at&order=desc vs. https://api.github.com/repos/ReporOwner/myrepo/releases?sort=published_at&order=asc). I'm guessing github API doesn't support sorting on this result set list.
Is there some other way I can get the date of most recent release?

Related

Azure Devops Dashboards - How to chart the trend of query results over time based on work item history?

I want to be able to generate a stacked bar chart based on the results of a query, for example the number of open bugs and open features. I would like to see the resulting number of open bugs vs features from that query over a time period, for example the last 30 days. Specifically the number of bugs vs features that were open on that particular day, regardless of their current status. Is there a way to do this using an existing out of the box widget? I believe it should be possible to figure out this information using the history. Alternatively, is it possible to simply store the totals from the query somewhere in devops and then chart it? Or would I need to write a script to export the query results via the api and then use something like the power bi widget to chart it?
Sure, you can set up a chart of the query about the bugs and features opened in the last 30 days.
To meet this demand, you can do like as the steps below:
Set up a query with the following filter clauses. Save this query to the Shared Queries folder.
Work Item Type In Bug,Feature
State = [Any]
Created Date >= #StartOfDay('-30d')
On the Charts tab of the new query, create a new chart for the query like as below.
After saving the chart, add this chart to a specified dashboard in the project.
After above steps, navigate to the specified dashboard in the project, you can see the chart on the dashboard.
[UPDATE]
According to your latest reply, you want to get the Bug and Feature that were open state in the last 30 days. For these work items, we can think they satisfy one of the following conditions:
The work items were closed in the last 30 days, no matter what date they were created.
The work items are still open state currently. They do not have the closed date yet.
So, set up the query like as below should be able to match these work items.
Work Item Type In Bug,Feature
And State = [Any]
And Closed Date >= #StartOfDay('-30d')
Or Closed Date =
Group the last two clauses.
Then create the chart for the query.
Maybe the stacked chart would go some way to answering your problem.
https://learn.microsoft.com/en-us/azure/devops/report/dashboards/charts?toc=%2Fazure%2Fdevops%2Fboards%2Ftoc.json&bc=%2Fazure%2Fdevops%2Fboards%2Fbreadcrumb%2Ftoc.json&view=azure-devops#add-a-trend-chart
That produces charts with date as the x axis which, I think, is what you're looking for.

How to get Committed Date in vsts online?

I'm using the Scrum Template and one of the Status is Committed, but there is no field for Committed Date. I have: Created, Closed, Accepted Date..
How can I get it?
There is no field for you to get a work item status changed date. But There has other two ways for you to get the date.
Option 1: by REST API
You can use get a list of work items revision to get a work item revisions by
GET https://account.visualstudio.com/DefaultCollection/_apis/wit/workitems/id/revisions?api-version=1.0
Then use System.State, System.CreatedDate and System.ChangedDate parameters in output to calculate the lead time between two status.
Option 2: manually calculate by view a work item history
You can view a WIT change history by this way:
Open a work item, and click History.
Then you can view the work item status changed date apparently. And calculate lead time manually.

How do i pull latest data from yahoo api?

I am trying to pull the Latest data from Yahoo API but i am not sure how to.....
In the YQL page
select * from yahoo.finance.xchange where pair in ("USDJPY")
What would i add at the end to pull the latest result?
I tried select * from yahoo.finance.xchange where pair in ("USDJPY") ORDER BY Date DESC LIMIT 1
But it doesnt work
Because at the moment, the time of the result is totally random.
Thanks for your time

When searching Issues or Pull Requests in Github, can you specify a date relative to "today"?

Is there a way to search Pull Requests (and likewise Issues) on Github where you specify a date range relative to today?
My team meets weekly with another team, and we like to present them a list of Github pull requests we've merged within the past week.
We can do a search for any items merged since a particular date with the filter:
is:pr is:closed merged:>=2016-03-31
But this needs to be updated every week, which is less than ideal. (As you can see, it's already out of date :)
However I see no mention of relative dates in their support article on searching issues:
https://help.github.com/articles/searching-issues/
Nor is there mention of relative dates in the search syntax article:
https://help.github.com/articles/search-syntax/
The search API may have been updated since this original question, but you can limit date ranges by duplicating the exclude params.
-created:<=2018-01-01 -created:>=2018-03-31 {other params...}
If you only want anything newer than 2018, then you can leave out the first part, e.g.:
-created:>=2018 {other params...}
I am not aware of a way to do this and as you mention their search documentation does not cover it.
However, the GitHub API does provide a created_at and an updated_at property for issues it returns, so depending on how useful it would be you might consider setting up a simple script to get all the issues related to specific repos and then filtering the response(s) you get back based on those properties.
I made a JS snippet that you can use in the URL section of a Chrome bookmark (haven't tested other browsers) that will dynamically set the created_at greater than filter to the date 14 days before the current date:
javascript:void(numDays = 14, d = new Date(),d.setDate(d.getDate() - numDays),day = ('0' + d.getDate()).slice(-2),month = ('0' + (d.getMonth() + 1)).slice(-2),year = d.getFullYear(),targetWin = window.open(`https://github.com/github/codeql/pulls?q=is%3Apr+is%3Aopen+created%3A>${year}-${month}-${day}`, %27_self%27))
Notes:
Make sure you update the url to match the repo you are querying on (it's currently set to the https://github.com/github/codeql repo)
You can adjust the numDays variable to the relative difference you want

SoundCloud API: Ordering by hotness with the "created_at" filter doesn't work

I am trying to determine the hottest tracks in the range of May 1 2012 to May 10 2012.
Unfortunately, the following query returns an empty set of tracks:
http://api.soundcloud.com/tracks?limit=20&order=hotness&created_at[from]=2012-05-01&created_at[to]=2012-05-10&consumer_key=
It is however clear that there exist tracks created in that range of time because the same query works when the order parameter is omitted:
http://api.soundcloud.com/tracks?limit=20&created_at[from]=2012-05-01&created_at[to]=2012-05-10&consumer_key=
I was hoping for the hotness algorithm to work across any range of time.
The other strange thing I found is that when a query parameter is specified along side the hotness and created_at parameters, results are returned:
http://api.soundcloud.com/tracks?limit=20&order=hotness&created_at[from]=2012-05-01&created_at[to]=2012-05-10&q=a&consumer_key=
Unfortunately it looks like the results are not sorted by hotness (though I think they may have been at some point in the past).
Any tips on how to get a list of tracks sorted by hotness within a specific time range?
The hotness parameter has been deprecated as of April 16th, 2013. As an alternative, you can rank tracks based on the number of plays (playback_count), downloads (download_count), favorites (favoritings_count), comments (comment_count), likes (likes_count), or reposts (reposts_count) on a track object.