alfred-awesome-lists icon indicating copy to clipboard operation
alfred-awesome-lists copied to clipboard

Edit Awesome List

Open azdanov opened this issue 6 years ago • 5 comments

There are some repositories that host readme.md instead of README.md which results in Page not found error on Github.

For example https://github.com/sindresorhus/awesome-nodejs/edit/master/README.md which should be https://github.com/sindresorhus/awesome-nodejs/edit/master/readme.md

Maybe a query could be done beforehand to verify that this file exists?

azdanov avatar Jul 09 '18 14:07 azdanov

Maybe a query could be done beforehand to verify that this file exists?

I was thinking of how I can solve this.

In near future, what I want to do is go inside each of the awesome lists and parse results to save to cache for all lists. So you search a list in Alfred, press enter and then inside Alfred again search for result you need (super fast as everything is cached). Alternatively you could press cmd + return and open the list in browser.

For opening CONTRIBUTING.md page I am not quite sure how to solve it. I wish GitHub solved it on their end so contributing.md and CONTRIBUTING.md are the same but since that's not the case your solution seems to be the only choice. It just seems kind of expensive to do it. But maybe I am wrong.

nikitavoloboev avatar Jul 09 '18 15:07 nikitavoloboev

There are some repositories that host readme.md instead of README.md which results in Page not found error on Github.

Can you explain a case where this happens and is an issue?

nikitavoloboev avatar Jul 09 '18 15:07 nikitavoloboev

I randomly stumbled upon this. When trying to open awe node with edit list command.

It's not a serious issue, since the workflow itself works.

azdanov avatar Jul 09 '18 16:07 azdanov

I'm wondering if it's possible to do a GraphQL query on the root of a repository, parse the result for needed file and then use the provided name. Or show an error that the file doesn't exist.

Something like this:

{
  repository(owner: "sindresorhus", name: "awesome-nodejs") {
    defaultBranchRef {
      target {
        ... on Commit {
          tree {
            entries {
              name
              type
            }
          }
        }
      }
    }
  }
}

Which returns:

{
  "data": {
    "repository": {
      "defaultBranchRef": {
        "target": {
          "tree": {
            "entries": [
              {
                "name": ".editorconfig",
                "type": "blob"
              },
              {
                "name": ".gitattributes",
                "type": "blob"
              },
              {
                "name": ".github",
                "type": "tree"
              },
              {
                "name": "code-of-conduct.md",
                "type": "blob"
              },
              {
                "name": "contributing.md",
                "type": "blob"
              },
              {
                "name": "media",
                "type": "tree"
              },
              {
                "name": "readme.md",
                "type": "blob"
              }
            ]
          }
        }
      }
    }
  }
}

azdanov avatar Jul 10 '18 07:07 azdanov

This might work. Will try it in a bit.

nikitavoloboev avatar Jul 10 '18 09:07 nikitavoloboev