I want to automate daily activity on my github so that when a potential employer checks out my github they will see that I've been extremely active. Can anyone suggest the most simple way to do this that would look convicing?
One way you could achieve a daily automated GitHub update is to use the GitHub API to changes that are done automatically, either through a bash script, or some other way.
In a project, pick some files that will change all the time. That might be configuration file or just create a new file with something in it every day.
You can automate this part with a cron job. Make the cron job create/update a file every day at the same time.
Then using the GitHub v3 api, you can either create/update files and push them to your repo. Again, this can be part of your cron job.
By using this API, you'll get a commit from GitHub that should be reflected in your contributions chart on your profile.
If we see the response from GitHub, you should get something like this, which should count as a contribution.
{
"content": {
"name": "hello.txt",
"path": "notes/hello.txt",
"sha": "95b966ae1c166bd92f8ae7d1c313e738c731dfc3",
"size": 9,
"url": "https://api.github.com/repos/octocat/Hello-World/contents/notes/hello.txt",
.
.
.
},
"commit": {
"sha": "7638417db6d59f3c431d3e1f261cc637155684cd",
<more things>
"author": { <response here>
"committer": { <response here>
"message": "my commit message",
.
.
.
}
Related
I am trying to generate a package collections from a GitHub entreprise account, using the command line (follwing the steps on the official doc):
package-collection-generate packages.json collection.json
When I ran this command, the Terminal ask me for my user name, once provided it keeps runing without a result, until I stop it using Ctl-C
The packages.json looks like this:
{
"name": "Entreprise iOS packages",
"overview": "This collection contains the entreprise Swift packages.",
"author": {
"name": "Swift packages"
},
"keywords": [
"iOS"
],
"packages": [
{
"url": "https://github.entreprise.com/[ORGANISATION]/[REPO].git"
}
]
}
I have also ttried to integrate my access token and user name in the url like this:
https://[UserName]:[AccessToken]#https://github.entreprise.com/[ORGANISATION]/[REPO].git
I have also tried to use the SSH url, with no success.
git#github.entreprise.com:[ORGANISATION]/[REPO].git
I can import the same package using Xcode Packages
I have SSH configured on my machine
I have tried to use both Private and Public access to the repo
With the same setup, I can create a collection using a non-entreprise GitHub account.
Maybe I am missing something or Swift Package Collection doesn't work with a GitHub Entreprise account!
Can you please advice what to do here?
You talk about a Github enterprise account but give a completely wrong URL in multiple places in your question (including your packages.json). Double-check that.
I have certain builds set for Continuous Integration, i.e., build for every check-in.
I have an automated method to perform code merge and check-ins; now I want to get the list of builds triggered for a particular changeset created. Is there any way we could get this information?
I would use the the REST API so you could check for builds that were run:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds
will return all builds that you could then go through and check for more details. You can also have more filters in the request (for example based on the build definition).
The build specifics you could then get via:
GET https://dev.azure.com/{organization}/{project}/_apis/build/builds/<buildid>
This will return you the infos like:
"triggerInfo": {
"ci.sourceBranch": "refs/heads/master",
"ci.sourceSha": "0fcb5a27ca2f73561dde0a066a1ec1781128fa81",
"ci.message": ""
},
...
"sourceBranch": "refs/heads/master",
"sourceVersion": "0fcb5a27ca2f73561dde0a066a1ec1781128fa81",
for builds queued from a git repository or
{ ...
"sourceBranch": "$/Build Test",
"sourceVersion": "93",
... }
for TFVC repositories. It actually also would contain a trigger info but I don't have any build around that was triggered automatically based on TFVC.
The sourceVersion in git will be the commit hash, where in TFVC it's the changeset.
More details on the REST API can be found in the Microsoft Docs
We have a number of tasks that we carry out every time we create a new GIT repository in our project, and I would like to know if there's a way to script (PowerShell or any other method) these out. for e.g. every these are the steps we follow everytime we create a new repo
Create a new GIT repo
Create a Build pipeline for Build validations during
pull request
Add branch policies to Master including a step to validate build using the above build
Create a Build pipeline for releases
Create a Release pipeline
Is there a way to script repetitive tasks in Azure DevOps?
Of course yes! As Daniel said in comment, just use REST API can achieve these all. But since the steps you want to achieve are little much, the script might be little complex.
Create a new GIT repo
If you also want to use API to finish this step, it needs 3 steps to finish that( Since this does not be documented in doc, I will described it very detailed ):
Step1: Create the validation of importing repository
POST https://dev.azure.com/{org name}/{project name}/_apis/git/import/ImportRepositoryValidations?api-version=5.2-preview.1
Request body:
{
"gitSource":
{
"url":"${ReposURL}",
"overwrite":false
},
"tfvcSource":null,
"username":"$(username}"/null,
"password":"${pw}"/"${PAT}"/null
}
Step2: Create the new repos name
POST https://dev.azure.com/{org name}/{project name}/_apis/git/Repositories?api-version=5.2-preview.1
Request body:
{
"name":"${ReposName}",
"project":
{
"name":"{project name}",
"id":"{this project id}"
}
}
Step3: Import repos
POST https://dev.azure.com/{org name}/{project name}/_apis/git/repositories/{the new repos name you create just now}/importRequests?api-version=5.2-preview.1
Request body:
{
"parameters":
{
"deleteServiceEndpointAfterImportIsDone":true,
"gitSource":
{
"url":"${ReposURL}",
"overwrite":false
},
"tfvcSource":null,
"serviceEndpointId":null
}
}
In these script, you can set variables in Variable tab, then use ${} to get them in the script.
Create a Build pipeline for Build validations during pull request
This step you'd better finish manually, because you can configure more about tasks and trigger with UI. If still want use API, refer to this doc: create build definition. There has detailed sample you can try with.
Add branch policies to Master including a step to validate build using the above build
This API still be documented in doc: create build policy. Just refer to that, and ensure use the correct policy type and the corresponding buildDefinitionId.
Create a Build pipeline for releases
This still recommend you finish manually, same with the step3 you mentioned.
Create a Release pipeline
See this doc: create release.
Note: For some parameter which will be used many times, you can set it as variable. For the parameter which need get from previous API response, you can define a variable to get its value then pass this variable into the next API to use.For e.g. :
$resultT= $result.Headers.ETag
Write-Host "##vso[task.setvariable variable=etag;]$resultT"
Now, you can directly use the $(etag) in the next API.
I'm trying to automatically create review apps as part of my pipeline and testing procedure when pull requests are created on the corresponding GitHub repository. When the PR is created, it appears as a review app, but doesn't actually get created.
In the DevTools console, a 404 error is there about the review-app-config. I'm not sure if this is directly related, as I've successfully created a review app on a different pipeline (with a different owner) with the same error.
This 404 error changes between the file not being available at all, or that it's returning an error. When it's the latter, the file contains the following:
{"id":"missing_version","error":"Please specify a version along with Heroku's API MIME type. For example, `Accept: application/vnd.heroku+json; version=3`.\n"}
I'm creating and managing all of the apps/pipelines with the GUI on dashboard.heroku.com. The version accept header appears to be needed for the Heroku API but I've no idea how to implement it. Any help would be greatly appreciated!
Firstly check that your app.json file is valid json. If it isn't then that will cause the deployment to fall over.
Secondly check if you have any scripts in the app.json key. If you have any here and they are incorrect then this will also cause it to hand and fall over with no warning displayed.
{
"name": "App name",
"scripts": {
"deploy": "command that won't work!!"
},
...
}
You many not need any scripts in here so it can also be empty!
{
"name": "App name",
"scripts": {},
...
}
I'm deploying a resource group to Azure consisting of a VM, a network, an Automation Account with some runbooks, among other things, using a JSON Template.
I'm getting the following errors,
New-AzureRmResourceGroupDeployment : 4:49:23 PM - Resource
Microsoft.Automation/automationAccounts/runbooks
'DeployAutomationName/AzureClassicAutomationTutorial' failed with
message '{ "code": "BadRequest", "message":
"{\"Message\":\"Invalid argument specified. Argument contentLink
cannot be null.\"}"
As well as:
New-AzureRmResourceGroupDeployment : 4:49:23 PM - Resource
Microsoft.Automation/automationAccounts/modules
'DeployAutomationName/Microsoft.WSMan.Management' failed with message
'{ "code": "BadRequest", "message": "{\"Message\":\"The
ContentLink property must be supplied in PUT or re-PUT operations.\"}"
}'
These two errors repeat for all sorts of different "Assets" ( I think that's the term) of my automation account. So for modules, runbooks, certificates, and connections.
What is a contenLink, and how can I make sure it's not Null? "ContentLink" apppears nowhere in my template, nor can I found any explanation on the internet of what exactly a contentLink is, besides this. Furthermore, I'm assuming that "PUT" or "re-PUT" is part of the rest API that delivers the template, and I have no direct control over this process either. Of what use is an error message that describes problems I have no direct control over?
This problem is synonymous with many of the difficulties I've had succesfully troubleshooting Azure templates: the error messages I get seem to be describing Azure Internals that I have no understanding of nor access too. How can I troubleshoot or debug when I don't have access to the code that is actually throwing these exception, nor the explanation of what this exception means?
Thanks! Here is my template , I would have only copied the relevant text, but I haven't a clue what is relevant and what's not:
Ok, so after poking a little bit, it looks like you are missing the runbook content (the script itself). so your runbook resource should look like this:
{
"type": "Microsoft.Automation/automationAccounts/runbooks",
"name": "[parameters('runbooks_AzureAutomationTutorial_name')]",
"apiVersion": "2015-10-31",
"location": "eastus2",
"properties": {
"runbookType": "GraphPowerShell",
"logVerbose": false,
"logProgress": false,
"publishContentLink": {
"uri": "[variables('scriptUri')]",
"version": "1.0.0.0"
}
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccounts_deployautomation_name_1'))]"
]
},
and the variable:
"variables": {
"scriptUri": "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/Runbooks/Get-AzureVMTutorial.ps1",
},
I can't test the whole template, as I don't have base64 values, but I believe this should solve your issue. There might be another one after this, thou ;) who knows.
Reference data: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-automation-runbook-getvms/azuredeploy.json
Also, you can just remove modules from the template, as they are not required, they are all the default ones, but for them the idea is the same, you are deploying the module without giving the module data.
And you might be missing other mandatory properties here and there, looks like Automation Script doesn't really work well with Azure Automation yet. You might want to resort to Powershell to provision Automation Account, as that works perfectly fine.
P.S. I have no idea what the content of the graphical runbook looks like. But i'd guess, you can export it and upload to github, and it would work.