Skip to content

Instantly share code, notes, and snippets.

View cp-sumi-k's full-sized avatar

Sumita Canopas cp-sumi-k

View GitHub Profile
// prepare headers
const config = {
headers: {
Accept: "application/vnd.github+json",
Authorization: "Bearer " + PERSONAL_ACCESS_TOKEN(PAT)
}
};
axios.get('https://api.github.com/repos/OWNER/REPO/actions/runs', config)
.then(res => {
axios.get('https://api.github.com/repos/OWNER/REPO/actions/runs', config)
.then(res => {
// res contains list of workflows
const workflows = res.data["workflow_runs"].filter(function (workflow) {
return workflow.name == "WorkflowName";
})
// getting id of first workflow
const wID = workflows[0].id
})
// prepare headers
const config = {
headers: {
Accept: "application/vnd.github+json",
Authorization: "Bearer " + PERSONAL_ACCESS_TOKEN(PAT)
}
};
/**
add filter using query params like below ,
func VerifyRecaptcha(token string) (bool, error) {
ctx := context.Background()
/** convert base64 formetted JSON to bytearray */
credBytes, err := b64.StdEncoding.DecodeString(os.Getenv("JSON_BASE64"))
if err != nil {
return false, err
}
/** create the assessment request */
request := &recaptchapb.CreateAssessmentRequest{
Assessment: &recaptchapb.Assessment{
Event: &recaptchapb.Event{
Token: token,
SiteKey: os.Getenv("RECAPTCHA_SITE_KEY"),
},
},
Parent: fmt.Sprintf("projects/%s", os.Getenv("RECAPTCHA_PROJECT_ID")),
}
ctx := context.Background()
/** convert base64 formetted JSON to bytearray */
credBytes, err := b64.StdEncoding.DecodeString(os.Getenv("JSON_BASE64"))
if err != nil {
return false, err
}
/** create reCaptcha client with JSON bytearray */
client, err := recaptcha.NewClient(ctx, option.WithCredentialsJSON(credBytes))
grecaptcha.enterprise.ready(() => {
grecaptcha.enterprise
.execute(import.meta.env.VITE_RECAPTCHA_SITE_KEY, {
action: "verify",
})
.then(function (token) {
/** append token with formData and send it to backend API */
})
.catch(() => {
/** invalid reCaptcha score */
let recaptchaScript = document.createElement("script");
recaptchaScript.setAttribute(
"src",
"https://www.google.com/recaptcha/enterprise.js?render=" + import.meta.env.VITE_RECAPTCHA_SITE_KEY
);
recaptchaScript.setAttribute("async", "true");
recaptchaScript.setAttribute("defer", "true");
document.head.appendChild(recaptchaScript);
module.exports = {
pluginOptions: {
electronBuilder: {
builderOptions: {
productName: "Your product name",
directories: {
buildResources: "resources",
},
win: {
icon: "resources/appx/storeLogo.png",
<template>
<picture>
<img
:src="images[2]"
:srcset="`${images[0]} 400w, ${images[1]} 800w, ${images[2]} 1200w`"
sizes="33vw"
alt="image"
/>
</picture>
</template>