Any way to get a link to a GitHub action's latest result? - github

GitHub's Actions feature recently started letting users generate badges, to showcase the status of their tests. For example, if I have a set of tests that run on my repo's dev branch from a file named .github/test_dev.yml, I can access that build's status by adding /badge.svg to the end of the test's URL.
https://github.com/<username>/<repo_name>/actions/workflows/test_dev.yml/badge.svg
That's great from the standpoint of keeping your project readme up to date with the status of the project, but the next logical step would be to also add a link to the badge that points to the latest testing outcome.
Unfortunately, even though you can access all the tests of a particular action as follows:
https://github.com/<username>/<repo_name>/actions/workflows/test_dev.yml
The test runs themselves seem to be behind a unique ID under actions/runs/.
https://github.com/<username>/<repo_name>/actions/runs/1234567890
Is there any way to construct a URL that just points to the latest test? Something like:
https://github.com/<username>/<repo_name>/actions/workflows/test_dev.yml?result=latest
I poked through GitHub's documentation, but even though there's some documentation surrounding the generation of those badge SVG's, I couldn't find anything about linking directly to the action that actually generated that SVG.

you can use this to get the id in a yaml file:
https://github.com/<username>/<repo_name>/actions/runs/${{ github.run_id }}

Related

An assertion on the test case file - Webdriverio

I need some help, I'm starting with this automation stuff, I like it but I'm still learning, recently I create a test case that basically is, going to a certain page and click on a button to upgrade the account on an specific sale, so I did that but when I got my PR reviewed and devops ask me if I can add an assertion.
So, this code is on the spec file not on the page objects file, so the devops mean I have to create the code on the page object file and then call it on the spec file???? any tip would be great and thanks!
You can do it either way. You can write the assertion in the spec file, or write the assertion in the page objects file and call it from the specs file. If the latter is your framework's code convention, you may want to do it that way for consistency, but either way should work.

Google Actions CLI 3.1.0 version and actions.intent.TEXT

I want to be able to talk with Google Assistant, but connect the Actions project directly to an NLP service I already have running on my server. In other words, NOT use dialogflow.
All the following examples show how to do this.
With Rasa
https://blog.rasa.com/going-beyond-hey-google-building-a-rasa-powered-google-assistant/
With LUIS
https://www.grokkingandroid.com/using-the-actions-sdk/
https://dzone.com/articles/using-the-actions-sdk-for-google-assistant-develop
With Watson
https://www.youtube.com/watch?v=no0R0bSkHXc
They use the actions.intent.MAIN as the invocation and actions.intent.TEXT for all other utterances from the talker.
This is what I need. I don’t want to create a load of intents, with utterance phrases, inside the Action because I just want all the phrases spoken by the talker to be passed to my server, and for my NLP service to deal with them.
So I set up a new Action project, install the Actions CLI and then spend 3 days trying all possible combinations without success, because all these examples are using gactions cli 2.1.3 and Google have now moved on to gactions cli 3.1.0.
Not only have the commands changed, but so too has the file formats and structure.
It appears there is also a new Google Actions Console, and actions.intent.TEXT is no longer available.
My Action is webhook connected to my server, but I cannot figure out how to get the action.intent.TEXT included and working.
Everything I find, even here
Publishing Actions on google without Dialogflow
is pre version update and follows the same pattern.
Can anyone point to an up-to-date, v3.1.0, discussion, tutorial or example about how to send all talker phrases through to an NLP that isn’t dialogflow, or has Google closed that avenue?
Is it possible to somehow go back and use the 2.1 CLI either with the new Console or revert the console back. (I have both CLI versions, I can see how different their commands are)
Is it possible to go back and use 2.1?
There is no way to go back to AoG 2. You probably also don't want to do so - newer features aren't available with v2 and are only available with v3.
Can I use my own NLP with v3?
Yes, although it isn't as obvious, and there are some changes in semantics.
As an overview, what you'll need to do is:
Create a Type that can accept "Free form text". I usually call this type "Any".
In the console, it looks something like this:
Create a Custom Intent that has a single parameter of this Any Type and at least one phrase that captures everything for this parameter. (So you should add one training phrase, highlight the entire phrase, and set it for the parameter. Sometimes I also add additional phrases that includes words that I don't want to capture.) I usually call the Intent "matchAny" and the parameter "any".
In the console, it could be something like this:
Finally, you'll have a Scene that you transition to from the Main invocation. When it matches the "matchAny" Intent, it should call your webhook with a handler name. Your webhook will be called with the "any" parameter set with the user utterance. (Note that the JSON has also changed.
Again, the console might have it looking something like this:
That seems like a lot of work. Isn't there just some way to do all that from the command line?
Yes. You can do all of that in the configuration files that the CLI accesses and then upload it. (You can then also use the console to review the configuration, if necessary, to make sure they're configured as you expect. You can shift back and forth between them as appropriate.)
Google also has a github repository that contains most of the files pre-configured for this sort of setup.
You will need to update the configuration from the repository to handle the webhook correctly (it includes code to illustrate what is happening using the inline code editor) and to add your project ID.

How do I get the deploy number for an AppVeyor webhook notification?

I have an environment in appveyor that I deploy to. I've configured a custom notification message that gets posted to a webhook to update the team on the deploy status. I've got the message tailored exactly how I want it except for one thing. I want to link to the appveyor deploy success/fail page. The url looks like this:
https://ci.appveyor.com/project/MeTheUser/myProject/deployment/12345678
I want the number at the end there. But I can't figure out the correct mustache template property to get. I've read the documentation here: https://www.appveyor.com/docs/notifications/#webhook-payload-default
and there's a line that says for deploy notifications, you just append build. to the front of the property. So, for example, {{build.projectName}} instead of {{projectName}}. But I don't see a property that would match since this is a deploy, not a build.
There's also a github issue to document this, but it doesn't look like it's getting done anytime soon.
Anyone know what I can do?
Use {{ deploymentId }} to get that deployment number or {{ deploymentUrl }} to get the entire deployment URL.

VSTS Extension - Release definition data, environment ids

I am developing web extension for VSTS. I am using vss sdk of Microsoft.
I got some issue.
You can see on the image that there is new line - App insights Settings
This pop up appears on clicking on 3 dots near every release definition on page of list of all releases.
This button navigates user to some environment of some specific release.
Example of link:
https://ozcodedev.visualstudio.com/OzCode/_releaseProgress?releaseId=372&_a=release-environment-logs&environmentId=850
The problem that I do not know how to fetch list of releases and environments for building this link.
How can I get them on page All release pipelines.
Through the GUI it is not possible to get all the release ids and the environment ids for each step. However this is possible through the VSTS APIS. You could use the release endpoint to and iterate to obtain your release id
https://{accountName}.vsrm.visualstudio.com/{project}/_apis/release/releases?api-version=4.1-preview.6
Once you have the release id you can use it like so
https://{accountName}.vsrm.visualstudio.com/{project}/_apis/release/releases/{releaseId}?api-version=4.1-preview.6
Within the returned JSON you can follow iterate the path environment[n].id to obtain the environment id.
You can then construct the link using this information.
Hope that helps
Ok. So after working 2 days on this issue I found solution.
1.It is possible to fetch data that I wanted on Client Side. For this I used Microsoft's library vss-web-extension-sdk. Install it - npm install vss-web-extension-sd --save.
2.Add relevant scopes to your vss-extension.json. In my case the problem was - that I needed data that relates to managing of VSTS user releases. So after Including "vso.release_manage" to my scopes array I stopped to got 401 Unauthorized error because access token was changed according to new scopes.
https://learn.microsoft.com/en-us/vsts/extend/develop/manifest?view=vsts#scopes
In this documentation you can check which scope controls which resources that can be accessed by your extension.
You can use our ts/js clients to get whatever you want for your experience.
We have extensive documentation available here. Let me know if you are blocked anywhere.

Reference GitHub file in jsFiddle

Is there a possibility to misuse grab files from a github repo as external resources in jsFiddle?
TLDR; Visit rawgit.com which will pop your files on a CDN straight from GitHub so you can use them.
Unfortunately none of the answers here worked for me. The rawgithub URL didn't seem to work as the connection gets refused. So here's a full solution that did work. Firstly in GitHub you need to click the Raw button to get the original JavaScript.
Then copy the URL from the page it takes you too. You'll notice if you try and use this directly you'll get a warning from JSFiddle.
More to the point is the browser will give you an error, e.g.:
Refused to execute script from https://raw.githubusercontent.com/nnnick/Chart.js/master/Chart.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.
Take that URL and visit rawgit.com. This will give you a URL of the format https://rawgit.com/nnnick/Chart.js/master/Chart.min.js which you can then use.
I've tried and tested this and it seems to work fine without issue
This is an updated answer, since the url's have changed slightly for Github... I ran into this issue and figured it out for present day. Hopefully this helps people out finding this post recently. Example for Bootstrap Slate theme from Bootswatch:
Raw file url: https://raw2.github.com/thomaspark/bootswatch/gh-pages/slate/bootstrap.css
Remove the 2. after raw: https://rawgithub.com/thomaspark/bootswatch/gh-pages/slate/bootstrap.css
That's it! :D
Nowadays JSDelivr seems to be the best option.
UPDATE
How to use or misuse github as kind of a CDN is not a thought that only benign "fiddlers" have; criminals have that thought also. Unfortunately, github, being as free and as anonymous as it is, is prone to be misused. As far as I can tell, the fact that some of the above solutions are things which are now broken, has to do with that.
Here is how I do it. It works now (Nov 2019), but it's admittedly not very convenient.
Get a github account yourself, if you don't already have one. Create a repository the name of which is identical to your github user name. That repo (and only that repo), - I'll call it the "home repo" - you can use as your web hosting service. https : // yourGithubUserName .github.io will show your home repo "raw/as it is" to the public. (Folder contents is not shown, and you HAVE TO have an index.html)
Now, if you want to use someone else's github repo in a fiddle, just copy over the complete repo to your home repo, and then just reference your copy of that repo with the src attribute of a script tag in the HTML part of the fiddle. Like this:
<head>
<script src="https://mathheadinclouds.github.io/thirdparty/esprima.js"></script>
<script src="https://mathheadinclouds.github.io/thirdparty/estraverse.browser.js"></script>
<script src="https://mathheadinclouds.github.io/thirdparty/escope.browser.js"></script>
</head>
<body></body>
Above snippet shows the HTML part of a working fiddle which is using the node modules esprima, estraverse, and escope, which is to say, the github repos of the same name. thirdparty is there because that's the name of the subfolder (in my home repo) where I put the copies.
As I said, not very convenient (lot's of copy and paste to set it all up), but that's what works for me.
And I should mention, just copy/paste might not be enough, you might have to do browserify or webpack on the referenced repo (if it was made for node, that is.)
here is the fiddle I was talking about.
OLD ANSWER
(works, but is kind of slow)
You can use requirify. It's made to enable you to require (as it is in node) on the browser command line; but it works in fiddles too, I tested it. I have no clue if it's "the best", compared to the other methods above (since I didn't go through them all and tested them), but it works.
Here is an example fiddle loading esprima (javascript parser), then escodegen (reverse javascript parser depending on esprima), then parsing and regenerating some simple javascript code.
what
require('lorem', 'ipsum')
does is, it loads the ipsum node module from npm, and puts the result into global variable named lorem. So this is only for npm modules not general github files which aren't also node modules. Shouldn't be much restriction since you can always turn it into a node module if it's your own project.
here it is
second example using same technique.
(((it's actually even simpler as shown in the fiddle. You can just put the 2 require statements right one after the other, you don't need a callback function in between (just one callback function to wait until both are loaded))))
Another possibility is to add the Git library to the cdnJS Script Repository (they write that any library that is resonably popular on GitHub will be accepted) and then use it as external resource.
Just found out: there are lots of Javascript libraries at http://jsdb.io/ and it's very easy to add new ones there--i's just a matter of entering the URL of a Github repository.
If there is a git repo in following folder structure
fiddletest/test1 (fiddletest is the repo name and test1 is a folder)
then the corresponding jsfiddle link will be
http://jsfiddle.net/gh/get/<library name>/<version>/<github user name>/fiddletest/tree/master/test1/
The folder and file structure must be like this
fiddletest(the repo name)
|____ test1
|____ demo.html
|____ demo.js
|____ demo.css
|____ demo.details
except these three files others will be ignored.
the details file should hold the fiddle details and link of external resources(if any) as follows
---
name: test fiddle repo
description: this is a test repo
resources:
- http://abc.xyz.com/abc.js
- http://abc.xyz.com/abc2.js
...
May be you have noticed the and in the fiddle link. If a fiddle is with pure js the the library name should be "library" and the version should be "pure"
In a nutshell the fiddle link to reffer to github should be in following format
http://jsfiddle.net/gh/get/<library name>/<version>/<github user name>/<repo name>/tree/<branchname>/<folder name>/
2021
Just go to github file and click "Download" button and copy URL - it will works with fetch - working example here (it not works in SO snippet - I don't know why) - example url from this file:
https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/VC/glTF-Embedded/VC.gltf