Sistemas y Tecnologías Web: Servidor

Master de II. ULL. 1er cuatrimestre


Organization ULL-MII-SYTWS-2122   Classroom ULL-MII-SYTWS-2122   Campus Virtual SYTWS   Chat Chat   Profesor Casiano

Descripción de la Práctica gh cli

gh alias

gh create-repo

Using gh api and gh alias --shell (do not use the existing gh repo create) add to gh an extension gh repo-create that creates the repo inside the given organization:

1
2
$ gh repo-create ULL-ESIT-PL-2021/tuturepo
$ gh repo view ULL-ESIT-PL-2021/tuturepo -w

image of create-repo.png

Use the GitHub REST API

gh delete-repo

The same but with delete:

1
$ gh repo-delete ULL-ESIT-PL-2021/tuturepo

Then, after issuing the command and refreshing the former page we get:

image of delete-repo.png

See the GitHub API doc for Delete repository

gh my-orgs-names

Escriba un alias que muestre todas las organizaciones tanto aquellas en que sea miembro público como privado de las mismas:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[~/.../gh-learning/gh-clone-org(master)]$ gh my-orgs-names | tail -8
GeneticsJS
tfm-y-pce-mfp-2021
MDCCVRP
cooking-lifeboold
ULL-MII-SYTWS-2122
ULL-ESIT-DMSI-2121
ULL-MFP-AET-2122
ULL-ESIT-PL-2122
[~/.../gh-learning/gh-clone-org(master)]$ gh my-orgs-names | wc
      65      65    1279
[~/.../gh-learning/gh-clone-org(master)]$ gh my-orgs-names | grep 1819
ULL-ESIT-PL-1819
ULL-ESIT-DSI-1819
ULL-MII-CA-1819

gh-org-members

Escriba un alias que reciba como argumento una organización y escriba los miembros de la misma:

1
2
3
4
5
6
7
8
9
10
11
$ gh org-members ULL-MII-SYTWS-2122 --jq '.[] | .login, .repos_url'
alu0100898293
https://api.github.com/users/alu0100898293/repos
alu0101102726
https://api.github.com/users/alu0101102726/repos
crguezl
https://api.github.com/users/crguezl/repos
PaulaExposito
https://api.github.com/users/PaulaExposito/repos
Pmolmar
https://api.github.com/users/Pmolmar/repos

Ahora con la información obtenida podemos ver los repos de un miembro fácilmente:

1
2
3
4
5
6
[~/.../gh-learning/gh-clone-org(master)]$ gh  api https://api.github.com/users/alu0100898293/repos -q '.[].name'
alu0100898293.github.io
eval-tareas-iniciales-NicolasHernandezGonzalez
express-start
prct01
prueba

gh-user-repos

Añada un alias gh-user-repos que nos de los repos de un usuario:

1
2
3
4
5
6
7
$ gh user-repos Pmolmar --jq '.[] | .name, .created_at' | pcre2grep -M '.+\n2021'
Pmolmar
2021-08-27T12:30:12Z
pmolmar.github.io
2021-08-27T12:31:13Z
SYTW-C
2021-09-30T17:57:17Z

Extension

Write and publish a gh extension using preferably Node.JS. Choose your own idea.

Suggestions.

Considerations about the delivery

Create a repo for your extension in a repo ULL-MII-SYTWS-2122/gh-my-extension-name inside the classroom organization ULL-MII-SYTWS-2122. Add that repo as a git submodule to the repo associated to this lab assignment. Just leave the link to the assignment and extensions repos in the campus virtual

Examples in JS and TS

See an example of how to write a gh extension in Node.JS in crguezl/gh-submodule-add.

An example of how to write an extension in TypeScript is here: mcataford/gh-assigned

References

Comment with GitHub Utterances