This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prepare headers | |
const config = { | |
headers: { | |
Accept: "application/vnd.github+json", | |
Authorization: "Bearer " + PERSONAL_ACCESS_TOKEN(PAT) | |
} | |
}; | |
/** | |
add filter using query params like below , |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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")), | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
pluginOptions: { | |
electronBuilder: { | |
builderOptions: { | |
productName: "Your product name", | |
directories: { | |
buildResources: "resources", | |
}, | |
win: { | |
icon: "resources/appx/storeLogo.png", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<picture> | |
<img | |
:src="images[2]" | |
:srcset="`${images[0]} 400w, ${images[1]} 800w, ${images[2]} 1200w`" | |
sizes="33vw" | |
alt="image" | |
/> | |
</picture> | |
</template> |