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

Adopt to Github Versions #6

Open
mostaphaRoudsari opened this issue Sep 28, 2015 · 1 comment
Open

Adopt to Github Versions #6

mostaphaRoudsari opened this issue Sep 28, 2015 · 1 comment
Assignees

Comments

@mostaphaRoudsari
Copy link
Member

We can use github's versions for the zip file as the main driver of the versions. The version input by user can move to README.md file.

@mostaphaRoudsari
Copy link
Member Author

Here is what I use now for input.json file. It can't be changed to README.md. Finding related files with each change can be tricky assuming there can be cases that not all the files get updated. Then there should be a recursive search to find the file. This functionality will be only useful for the viewer.

function get_commit_history(member, forkName, name){
  var dates = [];

  var inputFileHistory = "https://api.github.com/repos/" + member + "/" + forkName + "/commits?path=" + name + "/input.json";
  var inputHistoryString = UrlFetchApp.fetch(inputFileHistory).getContentText();
  var inputHistoryData = JSON.parse(inputHistoryString);

  // collect all dates
  for (d = 0; d < inputHistoryData.length; d++){
    var commit = inputHistoryData[d];
    // adding milliseconds to date > http://stackoverflow.com/questions/6683872/why-does-my-date-object-in-google-apps-script-return-nan
    var dt = Date.parse(commit.commit.committer.date.replace("Z", ".000Z"));
    var dtt = new Date(dt);
    dates.push(dtt);
  }

  // sort list of dates
  dates.sort();

  return dates
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant