Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Added how repo is selected section in README and other minor FAQs #49

Merged
merged 4 commits into from
Feb 2, 2023

Conversation

t-dedah
Copy link
Contributor

@t-dedah t-dedah commented Jan 23, 2023

What are you trying to accomplish?

Fix this issue #36

What approach did you choose and why?

Anything you want to highlight for special attention from reviewers?

@t-dedah t-dedah requested a review from a team as a code owner January 23, 2023 09:34
README.md Outdated
@@ -97,6 +97,8 @@ EXAMPLES:

> ℹ️ There could be multiple caches in a repo with same key. This can happen when different caches with same key have been created for different branches. it may also happen if the `version` property of the cache is different which usually means that cache with same key was created for different OS or with different [paths](https://github.com/actions/cache#inputs).

## How Repo is selected
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be put under a generic section for FAQ or troubleshooting?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added under FAQs

README.md Outdated
@@ -97,6 +97,8 @@ EXAMPLES:

> ℹ️ There could be multiple caches in a repo with same key. This can happen when different caches with same key have been created for different branches. it may also happen if the `version` property of the cache is different which usually means that cache with same key was created for different OS or with different [paths](https://github.com/actions/cache#inputs).

## How Repo is selected
This extension currently uses the `go-gh` module's [`CurrentRepository` function](https://github.com/actions/gh-actions-cache/blob/d3293b69e1c5bc17686d815ab2c64618618c95df/internal/utils.go#L26) to determine the current repo. This function returns the first element of the list returned by the `git.Remotes()` internal function, which [sorts remotes such that `upstream` precedes `github`, which precedes `origin`](https://github.com/cli/go-gh/blob/c2fc965daac88a8a38dd8af02f236095b5dd48f1/internal/git/remote.go#L30). As such, if an `upstream` remote is present, this extension's default behavior is to return its caches. User's input `--repo <owner>/<name>` will override any current git repository and extension will fetch caches for the same.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my learning - what is special about upstream and github remotes. origin is the default remote, isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

origin is the source for the current repo. So in case of forks origin will point to the fork's origin. In order to keep track between original and forked repo, we generally set a new remote upstream to the original repo. Now we can use git fetch upstream to sync forked and original repo. I am not sure about github remote

README.md Outdated
@@ -97,6 +97,8 @@ EXAMPLES:

> ℹ️ There could be multiple caches in a repo with same key. This can happen when different caches with same key have been created for different branches. it may also happen if the `version` property of the cache is different which usually means that cache with same key was created for different OS or with different [paths](https://github.com/actions/cache#inputs).

## How Repo is selected
This extension currently uses the `go-gh` module's [`CurrentRepository` function](https://github.com/actions/gh-actions-cache/blob/d3293b69e1c5bc17686d815ab2c64618618c95df/internal/utils.go#L26) to determine the current repo. This function returns the first element of the list returned by the `git.Remotes()` internal function, which [sorts remotes such that `upstream` precedes `github`, which precedes `origin`](https://github.com/cli/go-gh/blob/c2fc965daac88a8a38dd8af02f236095b5dd48f1/internal/git/remote.go#L30). As such, if an `upstream` remote is present, this extension's default behavior is to return its caches. User's input `--repo <owner>/<name>` will override any current git repository and extension will fetch caches for the same.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User's input --repo <owner>/<name> will override any current git repository and extension will fetch caches for the same.

Is this sentence related to rest of paragraph? Or can be a separate para.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated the line as next paragraph

@t-dedah t-dedah requested a review from bishal-pdMSFT February 1, 2023 23:52
@t-dedah t-dedah changed the title Added how repo is selected section in README Added how repo is selected section in README and other minor FAQs Feb 1, 2023
README.md Outdated Show resolved Hide resolved
Co-authored-by: Bishal Prasad <[email protected]>
@t-dedah t-dedah merged commit bf7745e into main Feb 2, 2023
@t-dedah t-dedah deleted the t-dedah/add-repo-info branch February 2, 2023 13:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants