GitHub 初心者向け:OSS コントリビュート入門ガイド
本文の状態
日本語全文を表示中
詳細モードで約9分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
GitHub Blog
GitHub は、オープンソースソフトウェアのコミュニティへの参加方法やプロジェクトの探し方、リポジトリの読み方を解説し、初めてのコントリビューション開始を支援する。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
GitHub for Beginners にようこそ。これまでに、GitHub Issues と Projects、GitHub Actions、セキュリティ、GitHub Pages、そして Markdown について議論してきました。今回はオープンソースソフトウェアと、そのコミュニティへの貢献方法についてお話しします。この記事を読み終える頃には、オープンソースとは何か、作業に適したプロジェクトを見つける方法、オープンソースリポジトリの読み方、そして最初の貢献を開始する方法がわかるようになります。では、始めましょう!
いつも通り、動画をご覧になりたい場合や参照したい場合は、YouTube で「GitHub for Beginners」のエピソードをすべてご覧いただけます。
オープンソースとは何か?
オープンソースソフトウェア(OSS)は、ソースコードが自由に利用可能であることを特徴とするソフトウェアを指します。「クローズドソースソフトウェア」と対照的に、OSS は誰でも使用し、それを基に構築することができるよう公に公開されています。つまり、コードベースやユーザー間のコミュニケーションを含むすべての作業が、誰もが閲覧できる状態にあります。
ソフトウェア開発の世界でまだ初心者の方にとって、オープンソースプロジェクトの閲覧や貢献は、世界中の無数のユーザーによって利用されている大規模で影響力のあるプロジェクトに触れる絶好の方法です。
GitHub はオープンソースソフトウェアの本拠地ですので、貢献できるプロジェクトを見つける方法を見ていきましょう。
オープンソースソフトウェアプロジェクトに初めて貢献するのは、誰もが経験するほど daunting(恐ろしい)ことかもしれません!最初のステップは、自分が知っている言語で新規コントリビューターを受け入れているプロジェクトを探すことです。これを行う一つの方法として、GitHub Copilot Chat に助けを求めることができます。
github.com にアクセスし、Copilot アイコンを選択してチャットウィンドウを開きます。
チャットウィンドウの左下隅にあるコンボボックスを使用して、「Ask(質問)」を選択します。
以下のようなプロンプトを入力してください。ただし、自分が慣れている言語に合わせて内容を更新することを忘れないでください。
TypeScript で書かれており、新規コントリビューターを受け入れているオープンソースプロジェクトの一覧を探しています。GitHub を検索し、「good first issue(初心者向け)」ラベルを使用しており、かつ GitHub 上でスターが 100 件以上のリポジトリに絞り込んでください。
Copilot が検索を実行し、「good first issue」ラベルでフィルタリングされた、探索可能なプロジェクトの一覧を返します。このラベルは、その課題が初心者にも親しみやすく、新規コントリビューターにとって最適な出発点であることを示しています。このラベルは、取り組むことができるプロジェクト内の課題を見つけるための素晴らしい方法です。
例えば、vscode リポジトリに貢献したいとしましょう。
vscode リポジトリへ移動します。
リポジトリの上部にある「Issues(課題)」タブを選択します。
「Issues」ページで、「Labels(ラベル)」ボックスをクリックしてドロップダウンメニューを開きます。
ドロップダウンメニュー内のテキストボックスに「good」と入力し始めると、「good first issue」のオプションが表示されます。
「good first issue」ラベルを選択します。
ウィンドウが更新され、取り組むべき「good first issues」のリストが表示されます。ただし、すぐに着手する前に、プロジェクトのリポジトリにあるコントリビューターガイドを読む必要があります。適切に維持されているオープンソースプロジェクトのほとんどには、必ずこのガイドが存在します。
オープンソースプロジェクトの理解
先ほど触れた通り、適切に維持されているオープンソースプロジェクトにはいくつか共通点があります。具体的には以下の項目です:
インストール手順が記載された文書化された README ファイル。
貢献方法について説明するコントリビューターガイド(Contributor's Guide)。
誰もがプロジェクトを自由に使用できることを示すオープンソースライセンス。
コミュニティで利用されていることを示す GitHub スター数が少なくとも 100 以上。
活発な開発が行われており、ソースコードのメンテナーがあなたの貢献をレビューできること。
新規コントリビューターを受け入れていることを示す「good first issue」ラベル。
貢献するプロジェクトを探す際、リポジトリで確認すべき点はこれらです。
優れたオープンソースプロジェクトを見つけるための詳細なドキュメントについては、gh.io/gfb-oss を訪れて、「good first issues」の探し方についてさらに学びましょう。
OSS への貢献を行う
では、実際のプロジェクトを見て、最初の issue を提出する方法を一緒に確認していきましょう。今回のデモでは「gitfolio」リポジトリをご覧ください。先ほどの箇条書き項目に基づき、これが取り組むのに適したプロジェクトかどうかを確認します。
このプロジェクトには文書化された README ファイルが用意されています。
また、コントリビューターガイド(CONTRIBUTING.md)も存在しています。
オープンソースライセンスを確認できます:LICENSE。
スター数が数千あり、100 というベンチマークを大きく上回っています。
ファイルリストの上部には、最も最近の実行結果が表示されており、これは比較的新しいものです。この文章を書いている時点では、最終実行は昨日のものであり、プロジェクトが積極的にメンテナンスされていることを示しています。
これらの点を踏まえると、TypeScript に慣れている方であれば、貢献に適したリポジトリと言えます。ただし、デモの続きを追うために TypeScript の知識が必要というわけではありません。
次に、リポジトリのフォークを作成します。フォークとは、オリジナルプロジェクトに影響を与えることなく自由に実験や変更を加えられるためのリポジトリのコピーです。オープンソースへの貢献には通常、このフォークが利用されます。リポジトリのフォーク方法について復習したい場合は、以前の「GitHub for Beginners」ブログ記事をご覧ください。
まだ移動していない場合は、プロジェクトのホームページへ移動してください。
プロジェクトページの上部にある「Fork」ボタンをクリックします。
新しいウィンドウでは、所有者を自分のアカウントのままにし、「Repository name」(リポジトリ名)がオリジナルのリポジトリと同じ(つまり"gitfolio")であることを確認してください。
ウィンドウの下部で「Create fork」を選択します。
フォークされたコピーのリポジトリ内で、ファイルリストから README.md をクリックします。
テキストを追加してファイルを変更します。
右上隅にある「Commit changes…」を選択します。
下部のオプションで、「このコミットから新しいブランチを作成し、プルリクエストを開始する」が選択されていることを確認してください。
「Propose changes」を選択します。
次のウィンドウで、[Create pull request] ボタンをクリックしてください。これにより、変更を加えたブランチからメインリポジトリに対してプルリクエストを作成できます。
「Open a pull request」ウィンドウの上部で、「compare across forks」を選択します。これにより、フォークされたリポジトリの変更点が元のリポジトリと比較して表示されます。
もし実際にリポジトリへ変更を提出するのではなく、デモの手順を踏んでいるだけの場合は、ここでプルリクエストにタイトルと説明を追加します。また、解決しようとしていた課題へのリンクを、プルリクエストの説明に記載することも望ましいでしょう。
この時点で、ウィンドウ下部のボタンをクリックしてプルリクエストを提出する準備が整います。ただし、一度それをクリックすると、それはもはやフォーク内の変更だけでなく、元のリポジトリに対する更新要求となります。そのため、上記の手順には含まれていません。実際にプルリクエストを提出すると、メンテナがレビューし、 hopefully 承認できるようになります。
承認されマージされると、GitHub は自動的にフォークされたリポジトリから変更を適用し、コードベースの公式な真実源である元のリポジトリのメインブランチに反映されます。
次に何をするか?
おめでとうございます!オープンソースソフトウェアへの貢献を行う方法を学びました。これがあなたのお気に入りのプロジェクトへの貢献へのインスピレーションになれば幸いです。
さらに詳しい情報をお探しの場合、役立つドキュメントが多数あります。以下にいくつかのリンクを記載します:
GitHub でオープンソースに貢献する方法を見つける
オープンソースプロジェクトへの貢献
フォークを通じてプロジェクトへの貢献
Happy coding!
この投稿「GitHub for Beginners: Getting started with OSS contributions」は、The GitHub Blog に最初に掲載されました。
原文を表示
Welcome back to GitHub for Beginners. So far, we’ve discussed GitHub Issues and Projects, GitHub Actions, security, GitHub Pages, and Markdown. This time we’re going to talk about open source software and how to contribute to that community. By the end of this post, you’ll know what open source is, how to find projects to work on, how to read an open source repository, as well as start making your first contributions. So let’s get started!
As always, if you prefer to watch the video or want to reference it, we have all of our GitHub for Beginners episodes available on YouTube.
What is open source?
Open source software (OSS) refers to software that features freely available source code. In contrast with “closed source software,” OSS is publicly available for anyone to use and build upon. This means that all of the work, including the codebase and communication between users, is available for everyone to see.
If you’re just getting started in the world of software development, browsing and contributing to open source projects is a great way to dip your toes into large, impactful projects used by countless users worldwide.
GitHub is the home for open source software, so let’s look at how to find projects you can contribute to.
How to find OSS projects to work on
Contributing to an open source software project for the first time can be daunting—we’ve all been there! The first step is to look for projects in a language that you know which are accepting new contributors. One of the ways you can do this is to ask GitHub Copilot Chat for help.
Navigate to github.com and select the Copilot icon to open a chat window.
In the bottom-left corner of the chat window, use the combo box to select Ask.
Enter a prompt like the following, but remember to update it for a language you’re comfortable with.
I’m looking for a list of open source projects written in TypeScript that are accepting new contributors. Search GitHub and narrow down the list to repositories that use the good first issue label and have over 100 stars on GitHub.
Copilot will do some searching and return a list of projects you can explore filtered by the good first issue label. This label indicates that an issue is beginner friendly, and a great starting point for new contributors. This label is a great way to find issues in a project you can work on.
For example, let’s say that you wanted to contribute to the vscode repository.
Navigate to the vscode repository.
At the top of the repository, select the Issues tab.
On the Issues page, click the Labels box to open the drop down menu.
In the text box on the drop down menu, start typing “good” until you see the option for good first issue.
Select the good first issue label.
The window will update and display a list of good first issues for you to work on. But before jumping in, you should read the contributor’s guide in the project’s repository. Most well-maintained open source projects will have one.
Understanding an open source project
As we just alluded to, most open source projects have a few things in common if they’re well maintained. These are the following items:
A well-documented README with installation instructions.
A contributor’s guide that explains how to contribute.
An open source license, so everyone knows the project is free to use.
At least 100 GitHub stars to show it’s used in the community.
Active development so that you know a maintainer of the source code will be able to review your contributions.
A good first issue label to indicate its open to new contributors.
When you’re looking for a project to contribute to, these are the things you should be looking for in a repository.
For more documentation on finding a good open source project, go to gh.io/gfb-oss to learn more about finding good first issues.
Making an OSS contribution
Now let’s look at an actual project and work on how you would submit your first issue. For this demo, take a look at the gitfolio repository. Using the bullet points above, we want to see if this would be a good project to work on.
The project does have a well-documented README file.
The project has a contributor’s guide: CONTRIBUTING.md.
You can see the open source license: LICENSE.
It has several thousands of stars, so well over our 100 benchmark.
At the top of the file list, you can see the most recent check in which should be fairly recent. While writing this, the last check in was yesterday, indicating the project is being actively maintained.
Based on these points, as long as you are familiar with TypeScript, this is a good repository to contribute to. However, you don’t need to be familiar with TypeScript to continue following along in the demo.
Now you want to create a fork of the repository. A fork is a copy of the repository that we can freely experiment on and make changes in without affecting the original project. We usually use forks for open source contributions. If you need a refresher on forking a repository, check out this previous GitHub for Beginners blog.
Navigate to the home page of the project if you are not already there.
At the top of the project, click the Fork button.
In the new window, leave yourself as the owner and make sure the “Repository name” is the same as the original repository (i.e., “gitfolio”).
At the bottom of the window, select Create fork.
In your forked copy of the repository, click README.md in the list of files.
Change the file by adding some text.
In the top-right, select Commit changes…
Make sure to select the option at the bottom for Create a new branch from this commit and start a pull request.
Select Propose changes.
On the following window, click the Create pull request button. This will let you create a pull request to the main repository from your branch with the changes.
At the top of the “Open a pull request” window, select compare across forks. This will show your fork’s changes compared to the original repository.
If you were submitting an actual change to the repository—not just walking through a demo—this is where you would give your pull request a title and a description. You’d also want to provide a link to the issue that you were solving in the description of the pull request.
At this point, you’d be ready to submit your pull request by clicking the button at the bottom of the window. However, once you do that, it no longer becomes just a change in your fork and will be a requested update on the original repository. That’s why it isn’t included in the steps above. When you do submit your pull request, it will be available and ready for a maintainer to review and, hopefully, approve!
Once approved and merged, GitHub automatically applies the changes from your fork into the main branch of the original repository, the official source of truth for the codebase.
What’s next?
Congratulations! You’ve learned how to make your own contributions to open source software. I hope it inspires you to contribute to your favorite projects.
And if you’re looking for more information, we have lots of documentation that can help. Here are a few links to get you stated:
Finding ways to contribute to open source on GitHub
Contributing to open source projects
Contributing to a project through forking
Happy coding!
The post GitHub for Beginners: Getting started with OSS contributions appeared first on The GitHub Blog.
関連記事
News to Guide
ニュースの次に確認する
発表内容を、現在の料金や仕様と照らし合わせられる関連ガイドです。
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み