Accessing raw files on GitHub using a URL + token - url

In a Gradle script I have referenced a file directly on my GitHub account like so:
buildscript { scriptHandler ->
apply from: 'https://github.com/raw/foo/bar-repo/master/repos.gradle?token=DFXD68SDF9DFKvNY-801UJHUHDUVdsd782MewA%3fks5D%3D', to: scriptHandler
dependencies {
// some dependencies
}
}
I got the URL by going to the "Raw" link on my GitHub page for the file in question.
When I run a local build everything works perfectly and my build can retrieve the raw file referenced with the URL that contains an access token.
Are there any dangers to this (I am keeping the URL private within my org). Will the token expire? I want to share common configuration such as URLs within the buildscript block, and this seems to be the simplest way of doing it.
EDIT:
I've gone to the Security section of my GitHub account and revoked all sessions and logged out (to end my current session). The URL still works.

Related

Insert generated URL into python script after authorization

I would like to know how to render a newly generated URL to my Python script without manually copy and pasting it.
I am being redirected from my script to the web page where I need to authenticate.
I want after I authenticate on a page that the new link is passed to the script.
Specifically, this is an OAuth1 process. This link is used to get my access token.
Thanks in advance!
If I copy and paste the link, i can perfectly get all the information and connect, but this is manually.

Electron Autoupdater with Private GitHub Repository?

I have implemented Electron AutoUpdater with PRIVATE GitHub Repository as provider to publish electron application. Now, i can publish it using GitHub repository but Whenever AutoUpdater tries to download the updates from GitHub repository, Everytime it prompts with response code 404 Not found.. I have tried passing token in setFeedURL method and also set it in GH_TOKEN but seems like that does not work either.
autoUpdater.setFeedURL({ provider: 'github'
, owner: 'owner'
, repo: 'repo-name'
, token: 'token'
, private: true });
So, Is there any way to get it working with PRIVATE GitHub Repository ?
Are you using electron auto-updater module? from the API documentation, I can see that they don't support.
On the other hand, if you are using electron-updater module, make sure that you are following the recommended release workflow, and you should not use setFeedURL check the note here
Updated:
If you are using electron-updater and you are publishing to a private repository, you will need to make sure that your token will be available within the app-update.yml file, that's why many say it's not recommended, if the token is not set in your app-update.yml file you will get 404.
For electron-updater to auto add your token to the app-update.yml file the token should be set within the publish section like the following:
"publish": [
{
"provider": "github",
"private": true,
"owner": "<github_owner>",
"repo": "<repo_name>",
"token": "<your github token>"
}
],
This will produce a app-update.yml file like the following:
owner: <github_owner>
repo: <repo_name>
provider: github
private: true
token: <your github token>
updaterCacheDirName: electron-updater-private-updater
Check this small video
Here is my code https://github.com/linuxjuggler/electron-auto-update-example check the electron-builder.json file.
Update 2
Based on the note mentioned in the Quick Setup Guide section, you should never call setFeedURL.
Auto-Update - you can see that private github repos works only for very special cases, and they are recommending to have a separate release-only repository to distribute releases so source is locked down, and you can distribute to controlled machines. It is a useful feature since no server is required, but special use case. Also, you can make this work with s3 bucket or some other upgrade servers.
I found this AutoUpdater Git Repo very helpful and my code is working now. Only change I needed to make is in github yml setting, add a token=<PersonalAccessToken> from github.
You can get Github personal token from Github > Settings > Developer Settings > Personal access tokens > Generate New Token
If anyone is still having this problem (I was stuck for weeks), I created a package to help with this. electron-github-autoupdater
It's pretty much an exact clone of Electron's autoUpdate API that accepts a config object for your private/enterprise github repo configuration and access token. It should just work.

user/project names in CircleCI 1.1 API

I'm trying to get information from the Circle CI REST API.
I can get make any call that doesn't require a vcstype/username/project to work properly such as /me?circle-token=<token>, however I can't get any that require vcstype/username/project to return anything except a 404 error.
In particular:
What is my username? Is it my github username (SuperTango)? I login to circleci with github, and the circleci "account settings" webpage doesn't actually show me any username. The /me API response has a field called login (which in my case is also "SuperTango"), but it doesn't have a field named username
What is the actual project name I should use here? Is it the name of the github project?
When trying to get a list of builds for a particular project, I have the following:
my username is "SuperTango"
i'm a github user
the project in github is called "funkware/funkware_app"
The docs say the url is:
GET: /project/:vcs-type/:username/:project
Build summary for each of the last 30 builds for a single git repo.
The base URL for all circleCI API requests is
https://circleci.com/api/v1.1/
Here's what I'm trying for the URL:
https://circleci.com/api/v1.1/project/github/SuperTango/funkware/funkware_app?circle-token=<token>
This URL is not working for me. I get back a 404 response with the webpage. As I mentioned up top, I can make the "/me" call, so I know my circle-token is correct. I don't know what else to try.
This question was already answered in the CircleCI Doc's GitHub project. I'll answer again here for completeness.
What is my username? - This is the username for your repository on GitHub or Bitbucket. This could be a personal user account, or it can be an organization username.
What is the actual project name? - This is the repository name on GitHub or Bitbucket.
For the example provided, the API call would be: https://circleci.com/api/v1.1/project/github/funkware/funkware_app?circle-token=<MY_TOKEN>.

Github API - create contents api method not triggering GitHub Pages build

I'm working on a Rails app that allows users to publish datasets via Github and access it via GitHub pages. I'm using the Github API to act as the user, create a repo and add the files, and everything works as expected, the only issue is that the GitHub pages page build doesn't seem to be happening. The datasets can be downloaded, but trying to access the index.html page doesn't seem to work at all.
Here's an example repo:
https://github.com/git-data-publisher/Foo
And here's the Github pages site:
http://git-data-publisher.github.io/Foo/
You can see that, for example:
http://git-data-publisher.github.io/Foo/data/June_2014.csv
Works fine.
I can only guess that this means the GitHub pages build isn't getting triggered. Any way I can make this happen without having to do a manual Git push?
You can also see my code here if this helps:
https://github.com/theodi/git-data-publisher
Github tries to parse you site as a Jekyll site.
You must indicate that you're not using Jekyll by creating an empty .nojekyll file at the root of your repository.

How do you deploy and build an application using bitbucket and AppHarbor?

Here is what I've done so far.
Grabbed the Repository URL from AppHarbor
In bitbucket, I configured the AppHarbor service to use that token.
For the project, I entered the same name of the application I used in AppHarbor (I have no idea what a slug is)
I saved the settings
I granted apphb read permissions in Access Management
I pushed to bitbucket. I even created a dummy changeset to make sure it would get a new push
In AppHarbor, I clicked on "Build URL" and it tells me that my URL was succesfully copied to the clipboard.
I followed the guide to the letter (well, with the exception of the slug, so I'm expceting that is the issue).
Steps to Follow and what gets filled in where:
On BitBucket:
Apphb needs read access to the repository (if it's private)
Go to admin
Add Service: AppHarbor
Token is the UglyValue from the "authorization=UglyValue" part of the build url
Project Name is the last part of the url when looking at that application on AppHarbor. So https://appharbor.com/applications/slug-is-here would use "slug-is-here"
Then you are good to go. You can get more complicated than that (like branches and whatnot) but that's the basic setup.

Resources