Skip to content

Processes

Josue Rios edited this page Jan 9, 2022 · 1 revision

List of processes a team member may need to do every once in a while

Grant admin privileges to an account

These steps assume the prod dreamerscholars project. You can change the URLs to use dreamerscholars-staging instead for the project used by the Render previews.

Prerequisites

If you haven't already, generate and save a new private key for our app's service account. DO NOT UPLOAD THIS KEY OR SHARE IT WITH ANYBODY!

Store this code in a file called makeAdmin.js:

var admin = require('firebase-admin');
var serviceAccount = require("./firebase-key.json");  // TODO: Set this to path to your key file
var uid = process.argv[2];
if (uid) {
    admin.initializeApp({
        credential: admin.credential.cert(serviceAccount),
        databaseURL: "https://dreamerscholars.firebaseio.com"
    });
    return admin.auth().setCustomUserClaims(uid, {admin: true}).then(() => {
        console.log("Custom Claim Added to UID.");
        process.exit();
    }).catch(function(error) {
        console.log('Error adding admin:', error);
        process.exit();
    });
} else {
    return console.log("uid argument required");
    process.exit();
}

Steps

  1. Copy the User UID from the Firebase console.
  2. Run
    node path/to/makeAdmin.js USERID
    where USERID is the ID you copied from the previous step.

Prune squashed in branches

You can save this alias:

alias gprunesquashmerged='git checkout -q main && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base main $branch) && [[ $(git cherry main $(git commit-tree $(git rev-parse "$branch^{tree}") -p $mergeBase -m _)) == "-"* ]] && git branch -D $branch; done'

And then simply run

gprunesquashmerged

Clone this wiki locally