Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENHANCEMENT] Display GitHub username instead of GitHub email #720

Open
jcscottiii opened this issue Sep 30, 2024 · 17 comments
Open

[ENHANCEMENT] Display GitHub username instead of GitHub email #720

jcscottiii opened this issue Sep 30, 2024 · 17 comments
Assignees
Labels
enhancement New feature or request hacktoberfest typescript Pull requests that update Typescript code

Comments

@jcscottiii
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
After a user logs in, it shows their email address. But it would be better to show their GitHub username.

Describe the solution you'd like
Background: Given GCP Cloud Identity Platform is meant to be very generic, we will have to do some additional steps as mentioned in these docs [1] [2] to actually get the username.

  • Create our own internal User type that is used inside the User context. It should extend the current User and then have a new high level field called GitHubUsername. which is string or null.
  • Create a lit task that is created and started within the onAuthStateChanged callback.
  • The playwright test will need to be modified to intercept a call to the GitHub API to return a fake username.
@jcscottiii jcscottiii added enhancement New feature or request typescript Pull requests that update Typescript code hacktoberfest labels Sep 30, 2024
@krafcik02
Copy link

Hello, I'd like to try and work on this, can you assign me this issue? :)

@jcscottiii
Copy link
Collaborator Author

Hi @krafcik02,
Definitely. First, can you try to set up your local environment first? Let me know if you have any issues. The instructions for getting started are in the Development.md in the repo.

@krafcik02
Copy link

Hi @jcscottiii I have added two extensions into vscode -> Dev Containers and Remote Development. Then I choosed "Reopen in Container" option.
Screenshot 2024-10-03 at 07 33 43
After it was sucessfully running. I have tried to check the ports on localhost that showed up, but they were just loading and provided nothing.
Screenshot 2024-10-03 at 07 38 34
Can you help with that?

@jcscottiii
Copy link
Collaborator Author

Can you share the terminal output of running make start-local and make port-forward-manual as described in this doc:

https://github.com/GoogleChrome/webstatus.dev/blob/main/DEVELOPMENT.md

Once you run those two commands, the servers should be up.

There are more commands up on that doc about creating a fake user for your environment too

@krafcik02
Copy link

krafcik02 commented Oct 4, 2024

I have ran the make start-local in terminal after opening directory via dev container extension the builder 5/14 ran successfully but for builder 6/14 i got this error. Also I couldn't run the make port-forward-manual in new terminal.


#11 [builder  5/14] RUN go work init &&     go work use ./lib &&     go work use ./lib/gen
#11 DONE 0.2s

#12 [builder  6/14] RUN --mount=type=cache,target=/go/pkg/mod     go mod download
#12 80.57 -> unzip /go/pkg/mod/cache/download/modernc.org/sqlite/@v/v1.18.1.zip: write /go/pkg/mod/modernc.org/sqlite@v1.18.1/internal/testfixture/testfixture_linux_386.go: input/output error
#12 80.58 -> unzip /go/pkg/mod/cache/download/modernc.org/tcl/@v/v1.13.1.zip: write /go/pkg/mod/modernc.org/tcl@v1.13.1/lib/tcl_linux_riscv64.go: input/output error
#12 80.58 go: unzip /go/pkg/mod/cache/download/modernc.org/sqlite/@v/v1.18.1.zip: write /go/pkg/mod/modernc.org/sqlite@v1.18.1/internal/testfixture/testfixture_linux_386.go: input/output error
#12 80.58 go: unzip /go/pkg/mod/cache/download/modernc.org/tcl/@v/v1.13.1.zip: write /go/pkg/mod/modernc.org/tcl@v1.13.1/lib/tcl_linux_riscv64.go: input/output error
#12 ERROR: error committing jv4g6bc86g7k3nm55afpnjj6j: write /var/lib/docker/buildkit/metadata_v2.db: input/output error
------
 > [builder  6/14] RUN --mount=type=cache,target=/go/pkg/mod     go mod download:
80.57 -> unzip /go/pkg/mod/cache/download/modernc.org/sqlite/@v/v1.18.1.zip: write /go/pkg/mod/modernc.org/sqlite@v1.18.1/internal/testfixture/testfixture_linux_386.go: input/output error
80.58 -> unzip /go/pkg/mod/cache/download/modernc.org/tcl/@v/v1.13.1.zip: write /go/pkg/mod/modernc.org/tcl@v1.13.1/lib/tcl_linux_riscv64.go: input/output error
80.58 go: unzip /go/pkg/mod/cache/download/modernc.org/sqlite/@v/v1.18.1.zip: write /go/pkg/mod/modernc.org/sqlite@v1.18.1/internal/testfixture/testfixture_linux_386.go: input/output error
80.58 go: unzip /go/pkg/mod/cache/download/modernc.org/tcl/@v/v1.13.1.zip: write /go/pkg/mod/modernc.org/tcl@v1.13.1/lib/tcl_linux_riscv64.go: input/output error
------
WARNING: current commit information was not captured by the build: failed to read current commit information with git rev-parse --is-inside-work-tree

 2 warnings found (use docker --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 15)
 - JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals (line 55)
ERROR: failed to solve: error committing jv4g6bc86g7k3nm55afpnjj6j: write /var/lib/docker/buildkit/metadata_v2.db: input/output error
Build [backend] failed: exit status 1. Docker build ran into internal error. Please retry.
If this keeps happening, please open an issue..

Cleaning up...
Cleaning up resources encountered an error, will continue to clean up other resources.
Cleaning up resources encountered an error, will continue to clean up other resources.
Cleaning up resources encountered an error, will continue to clean up other resources.
Cleaning up resources encountered an error, will continue to clean up other resources.
Cleaning up resources encountered an error, will continue to clean up other resources.
Cleaning up resources encountered an error, will continue to clean up other resources.
Cleaning up resources encountered an error, will continue to clean up other resources.
Pruning images...
WARN[0095] builder cleanup:pruning images: Error response from daemon: No such image: sha256:6f2fa4528f2ad71418430eafe3c3429b3578a6c464884616b5a29f67108eaee6  subtask=-1 task=DevLoop
build [backend] failed: exit status 1. Docker build ran into internal error. Please retry.
If this keeps happening, please open an issue..
make: *** [Makefile:37: start-local] Error 1
vscode ➜ /workspaces/webstatus.dev $ 

@jcscottiii
Copy link
Collaborator Author

At the end it mentions that docker ran into an internal error. Could you try again?

Additionally, there are multiple images building at the same time. If one fails for a reason, it will cause all the others to abruptly stop with error. Could you provide the full log?

@jcscottiii
Copy link
Collaborator Author

Also, thanks for going through this. If you have any feedback or suggestions to the documentation, please feel free to open a separate PR. We want this to be easy for everyone.

@krafcik02
Copy link

It all works now :). The error was in platform type.
In .dev/spanner/Dockerfile on line 26, I've changed platform type from amd64 -> arm64.

Misleading for me was just title "Running locally". I thought I need to run these commands in local terminal not the remote one (webstatus app in cloud runs).

Soon I will start with implementation. Thank you for you patience and help Mr.Scott. :)

RUN curl
-L -o wrench.tar.gz
.../releases/download/v${WRENCH_VERSION}/wrench-${WRENCH_VERSION}-linux-arm64.tar.gz" &&
tar -xf wrench.tar.gz && mv wrench /bin/

jcscottiii added a commit that referenced this issue Oct 4, 2024
In the spanner emulator, a version of wrench is downloaded. But it is hardcoded to amd64.

This change uses the auto populated TARGETARCH argument.

Now, we know which architecture to use when downloading the wrench CLI. Should fix the problem for those running the repo on a Macbook.

See: #720 (comment)
@jcscottiii
Copy link
Collaborator Author

That's good to know! I created this PR to solve the architecture problem:

#726

@krafcik02
Copy link

I have created my local branch and I have started with development.
Started devcontainer in vscode, run make start-local and in the second terminal make port-forward-manual.

Then I have added another title in webstatus-overview-content.ts to see local changes. I have saved a file, but at 127.0.0.1:5555 where the frontend is running the change was not present (even after reloading page). The source in developer console shows the old content.
Screenshot 2024-10-05 at 12 31 37
Screenshot 2024-10-05 at 12 31 52

How is it supposed to show local changes that i make in source code? Am I doing something wrong? Can you help me with this?

@jcscottiii
Copy link
Collaborator Author

In the first terminal, you should see the code recompile and deploy. It's not instant but it should happen quickly. The logs should show it there. Can you share the full logs after you do a save? Also, can you share a screenshot of your vs code tab with the change? Maybe make a typo in the title and save it to see it work.

@krafcik02
Copy link

I don't know really how, but I have somehow managed to make it work. I just made a typo and then tried to open all of the forwarded adresses. And then somehow it showed changed content. I think also you have to wait until the terminal outputs these lines:

Watching for changes...
[frontend] /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
[frontend] /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
[frontend] /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
[frontend] 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
[frontend] 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
[frontend] /docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
[frontend] /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
[frontend] /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
[frontend] /docker-entrypoint.sh: Launching /docker-entrypoint.d/setup_server.sh
[frontend] /docker-entrypoint.sh: Configuration complete; ready for start up
[frontend] 127.0.0.1 - - [05/Oct/2024:18:05:37 +0000] "GET / HTTP/1.1" 200 1154 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"

After that when I reload page in browser, it is working. I am sorry for bothering you with such a problem. Have a nice rest of day. :)

jcscottiii added a commit that referenced this issue Oct 5, 2024
In the spanner emulator, a version of wrench is downloaded. But it is hardcoded to amd64.

This change uses the auto populated TARGETARCH argument.

Now, we know which architecture to use when downloading the wrench CLI. Should fix the problem for those running the repo on a Macbook.

See: #720 (comment)
@krafcik02
Copy link

krafcik02 commented Oct 7, 2024

Hello James, I would like to test my API call with github, not just emulator. Would that be possible? If yes can you provide a guide to do so?

@jcscottiii
Copy link
Collaborator Author

Could you put up a PR? Let's discuss the next steps there.

@krafcik02
Copy link

krafcik02 commented Oct 9, 2024

I have commited changes that I've made in my branch, and tried to push changes, but got 403:

vscode ➜ /workspaces/webstatus.dev (krafcik02/github-username) $ git push --set-upstream origin krafcik02/github-username remote: Permission to GoogleChrome/webstatus.dev.git denied to krafcik02. fatal: unable to access 'https://github.com/GoogleChrome/webstatus.dev/': The requested URL returned error: 403 vscode ➜ /workspaces/webstatus.dev (krafcik02/github-username) $

@jcscottiii
Copy link
Collaborator Author

You will need to fork the project.

Read the docs here:
https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project

@krafcik02
Copy link

PR is ready now #743 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest typescript Pull requests that update Typescript code
Projects
Status: No status
Development

No branches or pull requests

2 participants