├── icon.png ├── screenshot.png ├── .vscode └── settings.json ├── alfred-github-search.alfredworkflow ├── readme.md ├── index.ts └── info.plist /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pawelgrzybek/alfred-github-search/HEAD/icon.png -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pawelgrzybek/alfred-github-search/HEAD/screenshot.png -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enable": true, 3 | "deno.lint": true, 4 | "deno.unstable": true 5 | } 6 | -------------------------------------------------------------------------------- /alfred-github-search.alfredworkflow: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pawelgrzybek/alfred-github-search/HEAD/alfred-github-search.alfredworkflow -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Alfred Github Search 2 | 3 | Alfred workflow to search for Github repository. 4 | 5 | ![Alfred Github Search screenshot](screenshot.png) 6 | 7 | ## Prerequisites 8 | 9 | - The [deno](https://deno.land) runtime installed 10 | 11 | ## How to use 12 | 13 | 1. Open Alfred App 14 | 2. Type `github` 15 | 3. Pass an argument to a script (name of a repository) 16 | 4. Wait for results 17 | 5. Then: 18 | - `Return` to open on Github 19 | - `cmd + c` to copy clone link. 20 | - Hold `cmd` to open pull requests 21 | - Hold `alt` to open issues 22 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | interface Meta { 2 | page: number; 3 | resultsPerPage: number; 4 | time: number; 5 | totalCount: number; 6 | totalPages: number; 7 | } 8 | 9 | interface Item { 10 | name: string; 11 | owner: { 12 | login: string; 13 | }; 14 | html_url: string; 15 | description: string; 16 | stargazers_count: number; 17 | open_issues_count: number; 18 | ssh_url: string; 19 | } 20 | 21 | interface Response { 22 | total_count: number; 23 | incomplete_results: boolean; 24 | items: Item[]; 25 | } 26 | 27 | try { 28 | const res = await fetch( 29 | `https://api.github.com/search/repositories?q=${Deno.args[0]}&sort=stars&order=desc` 30 | ); 31 | const body: Response = await res.json(); 32 | 33 | const packages = { 34 | items: body.items.map((item) => { 35 | return { 36 | title: `${item.name}`, 37 | subtitle: `${item.description} (${item.owner.login} | ${item.stargazers_count} stars)`, 38 | arg: item.html_url, 39 | mods: { 40 | alt: { 41 | valid: true, 42 | arg: `https://github.com/${item.owner.login}/${item.name}/issues`, 43 | subtitle: `Open Issues ${item.open_issues_count}`, 44 | }, 45 | cmd: { 46 | valid: true, 47 | arg: `https://github.com/${item.owner.login}/${item.name}/pulls`, 48 | subtitle: "Open Pull requests", 49 | }, 50 | }, 51 | text: { 52 | copy: item.ssh_url, 53 | largetype: item.ssh_url, 54 | }, 55 | }; 56 | }), 57 | }; 58 | 59 | console.log(JSON.stringify(packages)); 60 | } catch (error) { 61 | console.log( 62 | JSON.stringify({ 63 | items: [ 64 | { 65 | title: error.name, 66 | subtitle: error.message, 67 | valid: false, 68 | text: { 69 | copy: error.stack, 70 | }, 71 | }, 72 | ], 73 | }) 74 | ); 75 | } 76 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | bundleid 6 | com.pawelgrzybek.alfred-github-search 7 | category 8 | Productivity 9 | connections 10 | 11 | CD8B0843-794E-46D1-8D03-A8012CC67657 12 | 13 | 14 | destinationuid 15 | 9900D42F-E141-4452-B1EE-C24E9848EADE 16 | modifiers 17 | 0 18 | modifiersubtext 19 | 20 | vitoclose 21 | 22 | 23 | 24 | 25 | createdby 26 | Pawel Grzybek 27 | description 28 | Search for repo on github 29 | disabled 30 | 31 | name 32 | GitHub Search 33 | objects 34 | 35 | 36 | config 37 | 38 | alfredfiltersresults 39 | 40 | alfredfiltersresultsmatchmode 41 | 0 42 | argumenttreatemptyqueryasnil 43 | 44 | argumenttrimmode 45 | 0 46 | argumenttype 47 | 0 48 | escaping 49 | 102 50 | keyword 51 | github 52 | queuedelaycustom 53 | 3 54 | queuedelayimmediatelyinitially 55 | 56 | queuedelaymode 57 | 0 58 | queuemode 59 | 2 60 | runningsubtext 61 | Searching... 62 | script 63 | eval $(/usr/libexec/path_helper -s) 64 | eval "$($SHELL -i -l -c 'echo -e "\n"PATH=\"$PATH:\$PATH\""\n"' 2>/dev/null | grep "^PATH=")" 65 | export PATH 66 | 67 | if command -v deno >/dev/null 2>&1; then 68 | deno run --allow-net=api.github.com index.ts "$1" 69 | else 70 | echo $'{ 71 | "items":[ 72 | { 73 | "title": "Couldn\'t find the `deno` binary", 74 | "subtitle": "Symlink it to `/usr/local/bin`" 75 | } 76 | ] 77 | }' 78 | fi 79 | scriptargtype 80 | 1 81 | scriptfile 82 | 83 | subtext 84 | ex. github react 85 | title 86 | Search for github repo 87 | type 88 | 0 89 | withspace 90 | 91 | 92 | type 93 | alfred.workflow.input.scriptfilter 94 | uid 95 | CD8B0843-794E-46D1-8D03-A8012CC67657 96 | version 97 | 3 98 | 99 | 100 | config 101 | 102 | browser 103 | 104 | spaces 105 | 106 | url 107 | {query} 108 | utf8 109 | 110 | 111 | type 112 | alfred.workflow.action.openurl 113 | uid 114 | 9900D42F-E141-4452-B1EE-C24E9848EADE 115 | version 116 | 1 117 | 118 | 119 | readme 120 | 121 | uidata 122 | 123 | 9900D42F-E141-4452-B1EE-C24E9848EADE 124 | 125 | xpos 126 | 230 127 | ypos 128 | 60 129 | 130 | CD8B0843-794E-46D1-8D03-A8012CC67657 131 | 132 | xpos 133 | 60 134 | ypos 135 | 60 136 | 137 | 138 | variablesdontexport 139 | 140 | version 141 | 1.0.0 142 | webaddress 143 | https://pawelgrzybek.com/ 144 | 145 | 146 | --------------------------------------------------------------------------------