Trying to retrieve GitHub "Code Scanning" is enabled or not (GitHub API) - github

I am working on a GitHub automation using github APIs. As a part of this automation, I want to get the status of "Code Scanning".
https://api.github.com/repos/{Org}/{repo}/code-scanning/analyses
I have tried with above API endpoint but it's not giving me whether the code scanning is enabled or not. Its only retrieving the executions of code scanning. Therefore, if a user enabled the code scanning and then disabled it, then the above endpoint will retrieve result set for previous executions.
I checked the Graphql documentation as well, but I couldn't find any resource to retrieve this. Following is the field I want to retrieve using an API call.
GitHub code scanning field

Related

How do you make Test and Code Coverage publicly available

How do you make Test and Code Coverage from the Azure Devops publicly available, so (anonymous, without an MSDN account) users can see the results without having to have an account on your organization? I tried fiddling with the "Readers" settings within Azure DevOps but no luck. Typically, when users don't have an account the Code Coverage will load indefinitely and the Test tab is not shown.
Question 2: how can I provide a direct link (url) to my latest code-coverage for a specific build definition? Using Shield.io i was able to get a badge for the code-coverage but i also would like to provide a direct link to the report.
shields.io link to badge: https://img.shields.io/azure-devops/coverage/OffTheRecordv4/OTRv4/1
This is the project:
https://dev.azure.com/OffTheRecordv4/OTRv4/_build?definitionId=1&_a=summary
and the shield.io badge can be viewed here:
https://github.com/southernsun/otr
when logged in:
When logged out (spinning wheel never stops and nothing loads):
Thanks!
UPDATE
I created a feature request, feel free to support the request: https://developercommunity.visualstudio.com/idea/1069707/allow-code-coverage-and-test-plan-tabs-accessible.html
According to your description, you are working with a public project. A public project allows non-members of a project and users who aren't signed in read-only, limited access to the project's artifacts and services. Check the following table:
To contribute to a public project, you must be added as a member of that project and assigned either Stakeholder, Basic, or Basic + Test Plans access. The access level determines the user interfaces you can access. If you want users to access Test, you would need to assign Basic + Test Plans access to them.
Regarding how to get code coverage link, you may try Code Coverage - Get Build Code Coverage API, which would give you codeCoverageFileUrl in response.

Azure Devops - How to get published information of a wiki page using Rest API

I referred this Microsoft document "MS Rest API documentation for wiki" and was able to get all the pages available in wiki. I was trying to get the published author and published time related information for which there is no available reference.
Is there any Azure DevOps Rest API available to get this information?
Azure Devops - How to get published information of a wiki page using Rest API
I am afraid there is no such REST API at this moment, however you can track it by tools such as Fiddler or press F12 in Chrome browser then select Network.
On the web UI, we could access the View revisions of the Wiki:
We could get the history of this Wiki:
Then we press F12 and click the first history, we could get the REST API like below:
https://dev.azure.com/<OrganizationName>/<ProjectName>/_apis/git/repositories/<WikiName>/Commits/<CommitsId>?
But, if we want to automate it by REST API, This seems impossible at the moment.
To automate it, we need to get the first commit ID for the Wiki, I could use the REST API:
https://dev.azure.com/<OrganizationName>/<ProjectName>/_apis/git/repositories/<WikiName>/Commits/?
Now, I could get the all the commits, but those commits for all Wiki files, and there are no other parameters that can be used to filter out which wiki document the commit is associated with. So, we could not get the first commit for each wiki automatically. That is the current limitation.
Hope this helps.
You can get commits from specific pages: searchCriteria.itemPath=
Here is doc:
https://learn.microsoft.com/en-us/rest/api/azure/devops/git/commits/get-commits?view=azure-devops-rest-6.0
Wiki page path will be: /WikiName/Folder--Name/Page-Name.md
Keep in mind that space in page name or folder name you need to replace with '-'. Also add extension to the page '.md'

Jenkins REST API to get the changes related to a particular job

I need to get the changes of a particular job (not the build) through rest api.
I am able to get the changes relates to a build but unable to find the rest api to get the changes of a particular job.
I have used "http://jenkis_url:port/job/job_name/changes/api/json". This does not get display any useful data that I need but throws 404 error.
I can get changes of a build using the "http://jenkis_url:port/job/job_name/build_no/api/json".
Please suggest me the REST API to get the changes of a job.

Get changes associated with a build in Azure Devops using REST API

In Azure Devops under the "Summary" tab associated with a build, there are a list of changes (Git hashes, etc.) associated with the build. I'm trying to figure out how to get these via the rest API.
I found this REST API to get the changes between the two builds.
It works if I have the previous build id in the pipeline, however in the situation I'm interested in, I have the current build id, I need to somehow use the REST API to find the previous id.
Is there a way to do this using the REST API, or a better way to accomplish what I'm trying to do here?
As far as I can see, there's a special REST API call for that. You pass the buildId as a part of the URL and get the collection of changes (Change[]) in response.

Get All Issues on GitHub repository in specific month using GitHub API

I am trying to get all Pull requests created by specific user in a specific month in my django application using GitHub API.
e.g:
https://api.github.com/repos/myrepo/example/issues?creator=person_name&start_date=2018-1-1&end_date=2018-1-31
You can find issues created by a user in a given month using the search issues API endpoint, e.g.
https://api.github.com/search/issues?q=author:username+created:2018-01-01..2018-01-31
created can take a value like YYYY-MM-DD..YYYY-MM-DD to set a date range.
You might also want to add type:issue so you don't see pull requests or repo:user-or-org/repo to restrict results to a single repository.
Note that there are restrictions on searching users' contributions, including issues. You may need to have your users authenticate before you can search their issues. You should be able to try the endpoint out with your own user account, as long as you've got an authenticated session (e.g. by using a search URL in a browser where you're logged into GitHub).