Need a link/URL to a raw source file in Azure Dev Ops (ADO) - azure-devops

We recently migrated from Bitbucket to ADO and one of our platforms requires a link that will return the raw file for its deployment process. Bitbucket has a "raw" link available when viewing source files in the web UI, but I haven't found anything like that in ADO, the closest thing is a download link, but I need a link that just simply returns/displays the raw source file contents, not with a download dialog box. Is this possible?

I found that using the following in the api URL got me what I need:
_apis/sourceProviders/TfsGit
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/source-providers/get-file-contents?view=azure-devops-rest-5.0

Related

Is there a way to import GitHub issues to JIRA?

My team use Jira and we often work with open source software which are hosted on GitHub.
I often get request from my PM to update the status which can sometimes easily be followed using the GitHub public issue openend on one of those open source project.
Is there a way I can link a GitHub issue to a Jira ticket and sync all the GitHub comment in this Jira ticket ?
Answer is yes, it is.
If you want some manual import, you can check this Atlassian Community post.
As explained in here, you can perform with applying following steps:
Get list of issues in JSON format using following link from the browser
https://api.github.com/repos/\<repo-owner-name>/<repo-name>/issues?state:open
Convert JSON to CSV using any online converter
User Jira's External system import > choose CSV and upload the file.
Or, if you are looking for some programmatic way, you can check following page on zmccdn.

How do I protect my github website repository from being copied?

I built a website on github and would like to protect it from someone copying my repository and running the same website (either online or offline for themselves).
The website is fairly basic and builds on github action, which excute on schedule a Rmarkdown file that produces (updates) the index.html file. I want to avoid people being able to copy and freely execute that Rmarkdown file. I wonder if I could encrypt that specific file, and simply use a secret key with github actions to decrypt it when updating the website. Is this possible and would it be a good solution?
I also thought about having a private repository with my Rmarkdown file and simply push the html file to the public repository via github action, the problem is the github action takes a while to execute and I would quickly run out of the computation time (2000-3000 mins/month) offered by github.
I also thought about having a private repository with my Rmarkdown file and simply push the html file to the public repository via github action
That would have been the first approach, but since the RMarkdown process consumes to much tasks, it needs to be executed elsewhere.
Since other online free plans (like RStudio Cloud) are also limited in their project hours per month, another approach would be to call your own managed server (for instance, a Google Cloud compute engine, or Digital Ocean Droplet) where:
the RMarkdown file would reside (meaning, it would not be in the GitHub repository at all: no need to obfuscate/encrypt anything)
the process can take place
the generated index.html can uploaded back to your repository, and the rest of your GitHub action can publish the pages.

How to download a web.config file via the VSO rest api from a TFVC repository

The visual studio online rest api has a rest call to download the contents of a file in a TFVC repository. I want to download the latest version of all my TFVC repositories to have an on-premise back-up of all our projects.
This APi works great except for one type of file: web.config. When I want to download the web.config file I get a 404 statuscode. All other filetypes (also log4net.config and web.release.config) download correctly and I also get a 202 there. I have the correct permission to download the file and the file also exist.
I use the api as documented here: https://www.visualstudio.com/integrate/api/tfvc/items#Getafile
As you can see the path to the file in the repository is part of the URL. I think with this syntax, Visual Studio Online default security comes in way of files like web.config. In e.g. IIS the download of a web.config file is also disabled. For our git repositories this is no problem because that api doesn't include the path to the file in the url but as parameter of the url.
Is there a way around this? An undocumented feature?
When I see this documentation https://www.visualstudio.com/integrate/api/tfvc/items#Getaspecificversion it mentions:
You can indicate which version to get when you get a file, zip a folder, or get item metadata.
That zip a folder part is not (yet) documented. Does anybody of you know how to call that part of the api? That would also be a workaround for me.
This is now possible when you use the path as query parameter
This format should be used for certain files (like web.config) that are not accessible by using the path as part of the URL due to the default ASP .NET protection. The response is a stream (application/octet-stream) that contains the contents of the file.
http://fabrikam-fiber-inc.visualstudio.com/defaultcollection/_apis/tfvc/items?path=$/fabrikam-fiber-tfvc/website/website/web.config&api-version={version}
The above quote is from the documentation after this is added: https://www.visualstudio.com/integrate/api/tfvc/items#Getafile.

How do I self-host Jekyll?

I don't want to use github to host my new portfolio, I want to host it from my own site. How do I do this properly? Clearly, simply uploading all the files don't work (I just see Jekyll template text).
Has anyone done this?
You have to generate the site with Jekyll, and then upload the generated files to your web server. Jekyll's Usage and Deployment docs explain in more detail.

Set the name of a ZIP downloadable from GitHub or Other ways to enroll Google Transit project on GitHub

I wan to start a Google Transit project (a city transport feed for google maps) and for the purpose of collaboration I want to use GitHub. Now one great thing is that GitHub is offering a ZIP file download that contains all your repository, and Google wants a ZIP with a required data, but that file should have name: google_transit.zip.
So my question is:
Can I somehow give Google a link that will give it a file called google_transit.zip, that will contain all the stuff that's in the master branch? Maybe this can be done with standard "download zip" option or with some hooks or something elseā€¦
GitHub will allow you to automatically download a Zip archive of the latest version of a branch using the following url:
https://github.com/:user/:repository/zipball/:branch [GET]
The archive will be given a special name following the git describe command output.
However, there's one way to achieve what you're after by leveraging the GitHub Repo Downloads API.
Every time your master branch is ready to be published, you'd execute the following steps:
If the download resource google_transit.zip already exists, remove it
Create a new download resource and name it google_transit.zip
Upload the latest zip archive using the provided information of the previous request
There's even a Ruby library (ruby-net-github-upload) that may help you automating this task.