Today I Learned

2 posts by robertmrowiec

Automate Pull Request labels via Github Actions

Imagine You want to add automatic review me label when someone makes PR to master. You can do it by using Github Actions and action named “Labeler”.
At first You have to had this specific label added to your repository.

Next, move to Github Actions tab in your repository, and create new workflow with following code:

name: Your-Labeler-name // change it before commit
      - master // destination branch where this workflow will trigger

    runs-on: ubuntu-latest

    - uses: actions/labeler@v2
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        configuration-path: .github/Your-labeler-trigger-function-name.yml  //change it before commit

Commit this file and create new one in .github/ directory with this name (^). This file will define what changes should trigger this action and which label should be defined then. For example:

review me:
- "*"

will trigger and add review me label if any file in ROOT directory will change.

This example:

- "**"

will trigger and add bug label if any file in ANY directory will change.

Another example:

- example_directory/**/*

will trigger and apply hotfix label if any file inside example_directory or any nested directories inside it will change

If You need more informations, here’s official repository of Labeler action:

Backup and Restore Firebase Firestore data

If you want to backup or restore data from firebase firestore, you have to:

1. Create a new bucket on Google Cloud Console
On “Location Type” step, You can only use United States regions options, Europe options not working for imports/exports, so I recommend using Multi-region with US option selected

2. Setup gcloud via Cloud Shell
using command:

gcloud config set project YOUR_PROJECT_NAME

3.1 Export firestore data using same Cloud Shell and command:
gcloud alpha firestore export gs://YOUR_BUCKET_NAME

3.2. Import firestore data using same Cloud Shell:

Firstly, you probably want to change to another project than this, which You’ve backed up previously, don’t you?:

gcloud config set project YOUR_ANOTHER_PROJECT_NAME

Then you can import data by using this command:

gcloud alpha firestore import gs://YOUR_BUCKET_NAME/FOLDER_NAME (folder which was created inside a selected bucket during export function, always named as a date e.g. 

If you have any errors during import, most probably there is a problem with roles for default google service account. The fastest way to add required role is by using the command below:

gsutil iam ch \