Can I make a branch policy evaluation ID to required for specific pullrequest? - azure-devops

Azure devops creates unique evaluation ids for each branch policy. Is there a way I can make isBlocked to true for a specific evaluation ID for a specific pull request? Something like this requeue
https://learn.microsoft.com/en-us/rest/api/azure/devops/policy/evaluations/requeue-policy-evaluation?view=azure-devops-rest-7.0

Related

Display job requests API ADO with includeCapabilities

does the ADO API allow me to get an answer that contains jobrequests but with &includeCapabilities=true&demands=key -equals value?
I tried https://dev.azure.com/org/project/_apis/distributedtask/pools/id/jobrequests?api-version=7.0&includeCapabilities=true&demands=key-equals value
and no project. Unfortunately, it didn't show what I wanted.
The demands for required agents are the properties defined on the pipeline rather than the agent pool (or agents).
Normally, the REST API for Requests is used to return when and which jobs have requested the agents in the pool. It would not return the demands defined on the pipeline.
To get the demands defined on the pipeline, you need to use the REST API for Pipelines "Pipelines - Get". From the response of this API, you can get the demands defined on the agent jobs in the pipeline.
For example:

Azure DevOps - Rules, make required attachments on state change

I'm new to Azure Dev Ops and I'm trying to make a field required when State changes. For example, when the State Changes to Approver, the Reviewer Sign Off should be required. When I wrote the attached rule, it is not working. Rule Screenshot
The fields are On/Off fields. Can you please advice?
In the azure devops work item if we use the Boolean type of the fields. Then this field will be set to Require as default and we cannot change it.
And according to our call, I update my answer and help you create a demo.
Update
This is used to change state to Reviewer. And here are the steps:
Since we cannot use the Boolean type of the fields to help us set the required. So, we need to use another field to help us to do it. Here I use the Date/Time type.
We need to associate the field Review Sign Off and Review Sign Off Time. So we need to create other five rules (Two of them are used to prevent disoperation).
Here are the details:
Note: My test state is New -> fa -> Rev -> Close; this demo is used to set the rule from fa->Rev
Create the ChangeState rule:
Create the SetTime rule:
Create the ReadOnly rule: When the state was not the state before the Rev, make the sign off read-only
Create two other rule to prevent disoperation:

How cadence can save actions history?

My case is to approve, reject or return my request, and based on that workflow should change its status.
How candence can help here to save/retrieve all actions history for each workflow.
Workflow is code, so if you want to return the history of actions you would store them in a list variable and return it when queried.
As all workflow variables are persisted by the Temporal service there is no need to save them to a DB explicitly.

How can we add autotext (user name, timestamp) to entries in a mutliline text field in Azure Devops?

For multiline text fields in Azure DevOps work items, is it possible to add functionality that inserts the user name and a timestamp? Our old work tracking solution had a button labeled Stamp that performed this function but the lack of it in DevOps is causing some workflow and auditing issues. The information we need is part of the History for each work item, unfortunately it is not queryable data.
Something like this:
DeveloperLuke # 12/20/2018 9:01 AM
Solution XYZ deployed to ABC.Dev01
InfraLeia # 12/20/2018 10:35 AM
Solution XYZ failed to deploy to DEF.QA01 with error "Resource not responding. A34". Currently investigating.

Github API: Check if a branch or repository contains a commit

Can I use the Github API to check if a certain repository contains a certain commit?
At first glance, it seems that the get a single commit API call should work, returning 404 if there is no such commit in the repository. But that is not true: It seems that this call will run successful on commits that are present in forked repositories (possibly due to a pull request). (This effect can also be observed in the regular web interface; this particular commit has not been pulled into that repository yet.)
Api GitHub search
For searching other repositories one can use the api, which finds commits via various criteria. (This method returns up to 100 results per page.):
https://developer.github.com/v3/search/#search-commits
Only the default branch is considered, mostly master
Api usage
GET /search/commits
q can be any kind of search term combination: https://help.github.com/articles/searching-commits/
Example parameters for q
hash:124a9a0ee1d8f1e15e833aff432fbb3b02632105
Matches commits with the hash 124a9a0ee1d8f1e15e833aff432fbb3b02632105.
parent:124a9a0ee1d8f1e15e833aff432fbb3b02632105
Matches children of 124a9a0ee1d8f1e15e833aff432fbb3b02632105.
further parameters, like sorting, ordering can be found in the documentation above.
Usage example per hash:
example call https://api.github.com/search/commits?q=<searchterm>+<searchterm2>
specific call: https://api.github.com/search/commits?q=repo:adejoux/kitchen-wpar+hash:0a3a228e5b250daf06f933b35b3f0eafc715be4f
You need to add an special header, because the api is available for developers to preview
header to add: application/vnd.github.cloak-preview