List associated issues in Pull Request - github

In our Github organization, we merge everything to develop. Once a week we merge everything from develop to master. We want to have a list of all issues in the PR description based on the commits, which are linked to the issues (with #number of issue).
We have a Github Actions workflow that automatically creates the master PR. This PR usually has a lot of commits. We try to find a way to automatically write a comment with the titles of the issues which are referenced in the commits!
I tried to use the Github REST API but Im way to unexperienced with that so nothing seemed to work. I also tried to use some github changelog tools like this and this and tried to add them to a github action worklow, no success. Im also pretty new to github actions and coding in general.

Related

Is it possible to get a list of issues based on the commits of a PR using Github Actions

In our Github organization, we merge everything to "develop". Once a week or bi-weekly we merge everything from "develop" to "master". We want to have a list of all the issues associated with the PR in the PR description based on the commits, which are linked to the issues (with #).
We have a Github Actions workflow that automatically creates the master PR. This PR usually has a lot of commits. We try to find a way to automatically write a comment with the titles of the issues which are referenced in the commits.
I tried to use the Github REST API but Im way to unexperienced with that so nothing seemed to work. I also tried to use some github changelog tools like this and this and tried to add them to a github action worklow, no success.

GitHub - Create issues specific to a branch?

what I want to do is the exact opposite of what people normally do.
I want to create GitHub issues that apply only to a particular branch I'm currently working on. Ideally, they would not be visible when browsing other branches of the repo. Even more ideally, they would only be visible to the repo owner (me).
To give a little more context, I'm working on the next version of a rather large macOS app, and the new issues I want to create would only be relevant to this new version, not to the master branch (old app version). That is why I want these issues to only be associated with a specific branch, not with the repo as a whole.
I know that I can associate an issue with a "project" or "milestone" but I'm looking for something different.
Any ideas ? Thanks.
This is not possible. Issues are repository wide. You can add in the title or body of the issue that it is for a specific branch. Or you can use labels saying what branch it is for. You can also make a branch for the issue (if you have write access to the repository) differentiation it even more. And for when the PR is made you can link it.

Get an overview of my activities on GitHub

I would like to see an overview of my activities (e.g., commits in several branches, issues) on GitHub to see in which periods I was busy. I tried the following ways:
URL https://github.com/MYNAME/REPOSITORY/commits/?author=MYNAME, the problem is it returns only the master branch, while I have commits in other branches as well.
URL https://github.com/MYNAME?tab=overview&from=2022-02-01&to=2022-02-04, but the following graph does not seem to show commits in the branches other than master:
Does anyone have any ways to get a better overview? It is not necessarily by a direct URL, I could use GitHub Desktop, command lines, or a little bit of scripts as well.
Unfortunately, GitHub does not provide a way to see overall activity across branches in a repository, other than the default and the gh-pages branch - more information on https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile
As I haven't found anyone else resolving this, this leaves you with the option to write a piece of software that iterates through your repositories and checks the commits on all branches - introducing all kinds of challenges, such as overlapping commits and branches. Should be an interesting challenge though!

How can I make a second fork of a GitHub project?

I want to fork a github project to fix a couple of issues and then send a pull request.
The problem I'm running into is that I've already forked the project to adapt it for another user base.
Is it possible to create a second fork? If so, how?
When I try to fork now it just takes me to the previously created fork.
There is no way to have two forks of the same GitHub project unless you use two different GitHub accounts.
So:
Create a separate GitHub account (and verify the email)
Fork the
project
Invite your main GitHub account as a "Collaborator" (from
the settings)
You may need to add the extra step of creating an organization with the new GitHub account and inviting your main github account as an owner of the organization (also make sure your new fork is in that new organization). This will let you do things like deploy automatically to a Heroku app that is connected to your main GitHub account.
Why can't we just have multiple forks???
I mean that I could just commit and push without making a pull request, but I want to do it the offical way and I want somebody else to review the changes before I push to a public project.
GitHub pull requests do not need to be submitted from a fork; they work within a single repository as well:
Pull requests are especially useful in the fork & pull model because they provide a way to notify project maintainers about changes in your fork. However, they're also useful in the shared repository model where they're used to initiate code review and general discussion about a set of changes before being merged into a mainline branch.
There's nothing stopping you from creating a pull request even if you don't technically have to. This is often considered a best practice, and GitHub's own Flow model is largely based on pull requests.
Creating a pull request within a single repository is very similar to creating one from a fork:
Create a feature branch and push your work to that branch on GitHub
In the GitHub web UI, switch to your feature branch
Click the "Compare" & review button
The trick is not to use the master branch to create pull requests. Then you won't need to create multiple forks since you can make as many branches as you need and make pull requests against each branch independently.
Given a clean forked repo, create a dedicated branch and use that branch for the pull request.
You can create branches from the web UI (although it is not obvious).
Click the branch selection dropdown, type the new branch name in the input field, and then you'll see a clickable link Create branch: <new-branch-name> as shown below. The tricky UI part is that it might not be very obvious you should click the "create branch: xyz..." — it is NOT displayed as a button or as a hyperlink, and there is NO indication that this is a clickable link. Moreover, there is NO hint whatsoever that a branch can be created until you type in the search box — anyone would probably assume that the search box is used exclusively for searching branches, and not for creating them.
In case you already made changes directly in your fork's master branch then consider moving those changes into a dedicated branch and hard resetting the master branch to the original remote so that you keep it clean for synching with the upstream repo.
See also:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository
The best way, recommended by github manual, is use command line git, mirror clone your repo and push it to your github.
https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/duplicating-a-repository
If you strongly prefer GitHub web interface to the command line, a GUI friendly workaround is create a new organization and fork to that new organization.
Another GUI way I can think of is to declare a fork as a template repo using repo's setting so you can create as many forks as you need.

How to associate GitHub issues with a branch?

Nearly every issue I file on gh refers to code on a particular branch. Does github have any mechanism to link an issue to the branch?
I need to filter issues by branch, so I am not distracted by issues in other feature branches.
Is there a way to do this? I know milestones can be (ab)used to reach a similar effect, but things get really confusing when the branch becomes a pull request and it shows up as another issue.
References
Often times issues are dependent on other issues, or at least relate to them and you’d like to connect the two. You can reference issues by typing in a hashtag plus the issue number.
Hey #kneath, I think the problem started in #42
Issue in another repository? Just include the repository before the name like kneath/example-project#42.
One of the more interesting ways to use GitHub Issues is to reference issues directly from commits. Include the issue number inside of the commit message.
By prefacing your commits with “Fixes”, “Fixed”, “Fix”, “Closes”, “Closed”, or “Close” when the commit is merged into master, it will also automatically close the issue.
References make it possible to deeply connect the work being done with the bug being tracked, and are a great way to add visibility into the history of your project.
Since March 2022, you can:
Create a branch for an issue
You can now create a branch directly from an issue to begin development work that's correlated to that issue.
Branches connected to an issue are shown under the "Development" section, which has replaced "Linked pull requests", in the sidebar of an issue.
When you create a pull request for one of these branches, it is automatically linked to the issue.
For more information, see the documentation.
Here is an animated image showing how a branch is created for an issue.
After creation, the linked branch is shown in the Development section:
The OP asked:
I need to filter issues by branch, so I am not distracted by issues in other feature branches.
It is still in public beta, but the new Development section can help you list branches associated to issues:
So for any issue you need to work on, create a new branch:
Use labels to organize issues. They aren't inherently branch-specific, but you could make a tag for each branch if that is how you want them organized.
When you have admin access to the repository, there should be a button called 'manage labels' on the issue page. That will let you add, modify, or delete labels. You can apply labels to issues a few different ways. One way is to open the issue and click the labels button just to the right of the main body of text for the issue. Once you have created a label, it will appear on the left just above the manage labels button. You can click on each label to view all the issues that have been marked with that label.