PUBLIC_REPOSITORY

By GITHUB_USERNAME

PUBLIC_REPOSITORY Alternatives

Similar projects and alternatives to PUBLIC_REPOSITORY

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better PUBLIC_REPOSITORY alternative or higher similarity.

PUBLIC_REPOSITORY reviews and mentions

Posts with mentions or reviews of PUBLIC_REPOSITORY. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-02-17.
  • Build a Serverless Comment System for a Jamstack Blog
    3 projects | dev.to | 17 Feb 2021
    // comment-merge.ts import { AzureFunction, Context, HttpRequest } from "@azure/functions"; import util = require("util"); import * as querystring from "querystring"; import * as simpleGit from "simple-git/promise"; import fs = require("fs"); import { tmpdir } from "os"; import uuidv4 = require("uuid/v4"); import globstd = require("glob"); import rimrafstd = require("rimraf"); const rimraf = util.promisify(rimrafstd); const glob = util.promisify(globstd); const mkdir = util.promisify(fs.mkdir); const writeFile = util.promisify(fs.writeFile); const readFile = util.promisify(fs.readFile); const httpTrigger: AzureFunction = async function ( context: Context, req: HttpRequest ): Promise { context.log("HTTP trigger function processed a request."); context.res!.headers["Content-Type"] = "application/json"; //request content type is configured in GitHub webhook settings const payload = req.body; if ( payload.action != "closed" || payload.pull_request.base.ref != "main" || !payload.pull_request.merged_at ) { return; } // create temp repo and add remotes const tempRepo = uuidv4(); await mkdir(`${tmpdir}/${tempRepo}/comments`, { recursive: true, }); const git = simpleGit(`${tmpdir}/${tempRepo}`); await git.init(); await Promise.all([ git.addConfig("user.name", "GITHUB_USERNAME"), git.addConfig("user.email", "GITHUB_EMAIL"), ]); await Promise.all([ git.addRemote( "private", `https://GITHUB_USERNAME:${process.env["GitHubUserPassword"]}@https://github.com/GITHUB_USERNAME/PRIVATE_REPOSITORY` ), git.addRemote( "public", `https://GITHUB_USERNAME:${process.env["GitHubUserPassword"]}@https://github.com/GITHUB_USERNAME/PUBLIC_REPOSITORY` ), ]); // fetch public and integrate with latest modifications from private repo await git.fetch("public", "main"); await git.checkout("main", ["--", "comments/"]); await git.checkoutBranch("main", "main"); await git.fetch("private", "main"); await git.checkout("main", ["--", "comments/"]); // filter private data from comments // retrieve comment file paths const paths = await glob(`comments/**/*.json`, { cwd: `${tmpdir}/${tempRepo}/`, }); // wait for all paths to process asynchronously await Promise.all( paths.map(async (path) => { let pathData = []; //read JSON file with comment info pathData = JSON.parse( await readFile(`${tmpdir}/${tempRepo}/${path}`, "utf8") ); // filter out private info const publicData = pathData.map((item) => { const { authorEmail, ...store } = item; return store; }); // write file back to original with private data removed await writeFile( `${tmpdir}/${tempRepo}/${path}`, JSON.stringify(publicData, null, 2), "utf8" ); }) ); // add filtered comment file modifications, commit, and push await git.add(`${tmpdir}/${tempRepo}/comments/*.json`); await git.commit("approving comment"); await git.push("public", "main"); await rimraf(`${tmpdir}/${tempRepo}/`); context.res!.status = 200; context.res!.body = { message: "success" }; }; export default httpTrigger;

Stats

Basic PUBLIC_REPOSITORY repo stats
1
-
-
-

Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com