Skip to content

Instantly share code, notes, and snippets.

View error505's full-sized avatar
🏠
Working from home

Igor Iric error505

🏠
Working from home
View GitHub Profile
@error505
error505 / TypescriptAction.ts
Created April 4, 2023 10:51
Exampe of Typescript Action inside the workflow readin from json file
To run your own TypeScript GitHub Action inside your workflow, follow these steps:
1. Create a GitHub Action: In your repository, create a new directory (e.g., .github/actions/my-action) to store the TypeScript action's files. Inside this directory, create the following files:
action.yml: This file defines the action's inputs, outputs, and main entry point.
index.ts: This is the main TypeScript file that contains your action's logic.
package.json: This file defines the action's dependencies and other metadata.
2. Add the action's metadata: Edit the action.yml file and define the action's metadata as shown below:
YAML:
var serviceBusConnection = Configuration.GetConnectionString("ServiceBusConnectionString");
services.AddAzureClients(builder => { builder.AddServiceBusClient(serviceBusConnection); });
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"themeColor": "0076D7",
"summary": "New message",
"sections": [{
"activityTitle": "New message",
"activitySubtitle": "New message subtitle",
"activityImage": "https://somewebsite.com/image.png",
"facts": [{
@error505
error505 / TeamsMessage.cs
Created September 28, 2022 11:51
Model for the Teams Message
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MicrosoftTeamsNotification.Models
{
public class Fact
{
public string Name { get; set; }
public string Value { get; set; }
}
@error505
error505 / MessageClient.cs
Created September 28, 2022 11:46
Message client for sending the HTTP message to the Microsoft teams webhook
using MicrosoftTeamsNotification.Models;
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace MicrosoftTeamsNotification.Tasks
{
public static class MessageClient
@error505
error505 / ProcessMessage.cs
Created September 28, 2022 07:10
Azure Function to send process Azure Service Bus message and to send the Microsoft teams message over the webhook
namespace MicrosoftTeamsNotification;
public class ProcessMessage
{
[FunctionName("ProcessMessage")]
public async Task Run([ServiceBusTrigger("testqueue", Connection = "ServiceBusConnection")] string myQueueItem, ILogger log)
{
try
{
var message = JsonConvert.DeserializeObject<MessageToProcess>(myQueueItem);
@error505
error505 / SendServiceBusMessage.cs
Created September 28, 2022 06:53
Send message to azure service bus client
using Azure.Messaging.ServiceBus;
using Newtonsoft.Json;
namespace WriteMessageToServiceBus;
public class SendServiceBusMessage
{
private readonly ServiceBusClient _serviceBusClient;
public SendServiceBusMessage(ServiceBusClient serviceBusClient)
@error505
error505 / powershell-security.ps1
Created July 3, 2018 11:13
Security protocols in powershell
Add-Type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
@error505
error505 / export-unicorn.js
Created July 3, 2018 11:10
Gulp task for unicorn files export
gulp.task("Export-Unicorn-Files", function () {
var destination = config.unicornExportFolder;
var root = "./src";
var roots = [root];
var files = "/**/serialization/**/*.yml";
return gulp.src(roots, { base: root }).pipe(
foreach(function (stream, file) {
console.log("Exporting from " + file.path);
gulp.src(file.path + files, { base: file.path })
.pipe(newer(destination))
@error505
error505 / CustomBucketViewSitecore9.html
Created June 15, 2018 11:35
Custom Bucket View Sitecore9
<div id="ItemIdPlaceholder" class="BlogPostArea" onclick="scForm.getParentForm().postRequest('','','','LaunchTypePlaceholder(url=ItemIdPlaceholder)'); return false;" style="margin-left:0px;">
<div class="BlogPostViews">
<a class="ceebox imgcontainer" title="" href="#" onclick="scForm.getParentForm().postRequest('','','','LaunchTypePlaceholder(url=ItemIdPlaceholder)'); return false;">
<img onerror="this.onerror=null;this.src='/temp/iconcache/office/48x48/user.png';" src="ImagePathDynamicPlaceholder" class="attachment-post-thumbnail wp-post-image" alt="FirstNameDynamicPlaceholder LastNameDynamicPlaceholder" title="FirstNameDynamicPlaceholder LastNameDynamicPlaceholder">
</a>
</div>
<h5 class="BlogPostHeader">
<a href="javascript:void(0);" onclick="scForm.browser.clearEvent(event || window.event, true);scForm.getParentForm().postRequest('','','','LaunchTypePlaceholder(url=ItemIdPlaceholder)'); return false;">FirstNameDynamicPlaceholder LastNameDynamicPlaceholder</a>
</h5>
<div class="BlogPos