How to display GitHub action badge for current running branch? - github

I need to show the GitHub action badge for the current running branch, instead, it is limited to one branch(default or specified).

As the "Adding a workflow status badge" mentions, displaying the status of a workflow run for a specific branch or event is only done using the branch and event query parameters in the URL.
But those parameters are fixed. Modifying them would mean updating the README every time a new action is running.
Said action can get the name of the branch it operates on (see "How to get the current branch within GitHub Actions?")
But you would then need to combine that action with, for instance, github-update-readme in order to include the right URL for the badge:
![example](https://github.com/github/docs/actions/workflows/main.yml/badge.svg?branch=${GH_BRANCH})
^^^^^^^^^^
(value computed from the previous step by your main action)

Related

Azure board bug has state "resolved" after pull request instead of "closed"

The Azure DevOps Board works with pull requests. The stories are always automatically set to the status "Closed" at the PR, as desired. The problem now is that the status of the work item bug is set to "Resolved" instead of "Closed" after the PR, which means that the item is no longer visible on the board.
I have tried to correct a setting in the PR, as well as in the process settings of the board, however I can't find a suitable place how this can be solved.
If the item bug is moved manually on the board, it has the status "closed" as expected.
Settings: We use a copy of the "Agile" process for the project.
Question: How do I configure the project/board so that a bug that is closed by the PR has the status "Closed" instead of "resolved"?
How do I configure the project/board so that a bug that is closed by the PR has the status "Closed" instead of "resolved"?
I am afraid that there is no out-of-box method can custom the work item state when completing the Pull Request.
For a workaround, you can disable the option: Complete associated work items after merging when completing Pull Request.
Then you can modify the Pull Request description with the following format: Closed: #workitemid
For example:
Then when you complete the pull request, the work item state will change to closed.
For more detailed info, you can refer to this doc: Set work item state in pull request
I can fully understand your requirement. Here is an existing Suggestion ticket about the feature request: Ability to configure target work item state after completing PR

How to determine the source branch name in Github webhook push event?

The push webhook only contains the target branch name (ref parameter). But I want to extract the source branch name, meaning the branch which was merged in the target one. I haven't found anything like that among the Github push event parameters (https://developer.github.com/v3/activity/events/types/#pushevent).
But maybe I just missed it or there is another method to do so?

how to check any open pull request in GitHubs?

I got a coding challenge from a company and they require to complete a project on https://www.hatchways.io/
I already completed all of the code, but as I submit it shows that
{ Before you submit the Front-end Work Simulation - Hatchways Times project, you will need to pass the following pre-checks:
You must have an open pull request. ❌
You do not have multiple pull requests opened. ✅
Sorry, looks like you didn't pass all the pre-checks above. Please make sure you satisfy all the requirements before you retry. }
I have two branches one is 'main' another one is 'practice'. I already checked I don't have any pull request both of branches.
Is there anyone know how to solve it please?
Pull Request
record of pull request
Click New pull request
Set the branch to practice and the base branch to main
Submit

Azure Devops - Change ticket assignee using PR markdown

In Azure Devops, I can add markdown in a pull request's description to automatically change a linked ticket's state once the pr is completed, like this:
NewState: #TicketNumber
for example:
Committed: #1000
Is there a way to also change the assignee? I have tried:
#PersonName: #TicketNumber
but it didn't apply the change.
You can try using the work item rules to do this.
For example, you can create the rule as when the work item state is changed to completed (Closed, Done, Completed, etc.), set the assignee to the specified user.
To view more details, you can see "Add a rule to a work item type".
However, this method will always assign the work item to the same user who is specified in the rule whenever the work item state is changed to completed.
If you want to dynamically set the assignee according to the user you mentioned in the description, this methods is not available. In this situation, you can try to set up a pipeline with the following steps:
Try to get the linked work item ID, and the account information (username and email address) of the user you want to assign the work item to.
Try using the API "Work Items - Update" to changed the assignee.

How can I modify the state a work item is changed to after PR?

When we create a pull request and link a work item, after the PR is completed the status of the work items are automatically changed to "invalid". How can we change that behavior to a different status?
In a recent update to Azure DevOps, you can now customize work item state when pull request is merged.
When you create a PR, in the description, you can set the state value
of the linked work items. You must follow the specific syntax.
{state value}: #ID When you merge the PR, the system reads through
the description and updates the work item state accordingly. In the
follow example we set work items #300 and #301 to Resolved, #323 and
#324 to Closed.
The Set work item state in pull request feature is also works for custom states. Here is my sample:
Add a custom state to task.
Create a new pull request and add the Description like:
Ready for QA: #id
Create pull request and complete the merge. Do not check "Complete linked work items after merging" option.
Now, the status of my task has been updated to Ready for QA.
In addition, the product group is still improving this feature. If you have any concern or suggestions, you can share it in this suggestion ticket and this one.