Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Init cloud functions #547

Merged
merged 9 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"oderwat.indent-rainbow",
"mhutchie.git-graph"
"mhutchie.git-graph",
"kenomaru.thunder"
]
}
},
Expand Down
118 changes: 59 additions & 59 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
# Add 'root' label to any root file changes
# Quotation marks are required for the leading asterisk
root:
- changed-files:
- any-glob-to-any-file: '*'
# Add 'Documentation' label to any change to .md files within the entire repository
Documentation:
- changed-files:
- any-glob-to-any-file: '**/*.md'
# Add 'source' label to any change to src files within the source dir
source:
- all:
- changed-files:
- any-glob-to-any-file: 'src/**/*'
# Add 'pages' label to any changes within the entire repository
pages:
- changed-files:
- any-glob-to-any-file: 'pages/**/*'
# Add 'public' label to any changes within the entire repository
public:
- changed-files:
- any-glob-to-any-file: 'public/**/*'
# Add 'globals' label to any changes within the entire repository
globals:
- changed-files:
- any-glob-to-any-file: 'globals/**/*'
# Add 'firebase' label to any changes within the entire repository
firebase:
- changed-files:
- any-glob-to-any-file: 'firebase/**/*'
# Add 'context' label to any changes within the entire repository
context:
- changed-files:
- any-glob-to-any-file: 'context/**/*'
# Add 'workflows' label to any changes within the entire repository
workflows:
- changed-files:
- any-glob-to-any-file: '.github/**/*'
# Add 'devcontainer' label to any changes within the entire repository
devcontainer:
- changed-files:
- any-glob-to-any-file: '.devcontainer/**/*'
# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
feature:
- head-branch: ['^feature', 'feature']
# Add 'release' label to any PR that is opened against the `main` branch
release:
- base-branch: 'main'
# Add 'root' label to any root file changes
# Quotation marks are required for the leading asterisk
root:
- changed-files:
- any-glob-to-any-file: '*'

# Add 'Documentation' label to any change to .md files within the entire repository
Documentation:
- changed-files:
- any-glob-to-any-file: '**/*.md'

# Add 'source' label to any change to src files within the source dir
source:
- all:
- changed-files:
- any-glob-to-any-file: 'src/**/*'

# Add 'pages' label to any changes within the entire repository
pages:
- changed-files:
- any-glob-to-any-file: 'pages/**/*'

# Add 'public' label to any changes within the entire repository
public:
- changed-files:
- any-glob-to-any-file: 'public/**/*'

# Add 'globals' label to any changes within the entire repository
globals:
- changed-files:
- any-glob-to-any-file: 'globals/**/*'

# Add 'firebase' label to any changes within the entire repository
firebase:
- changed-files:
- any-glob-to-any-file: 'firebase/**/*'

# Add 'context' label to any changes within the entire repository
context:
- changed-files:
- any-glob-to-any-file: 'context/**/*'

# Add 'workflows' label to any changes within the entire repository
workflows:
- changed-files:
- any-glob-to-any-file: '.github/**/*'

# Add 'devcontainer' label to any changes within the entire repository
devcontainer:
- changed-files:
- any-glob-to-any-file: '.devcontainer/**/*'

# Add 'feature' label to any PR where the head branch name starts with `feature` or has a `feature` section in the name
feature:
- head-branch: ['^feature', 'feature']

# Add 'release' label to any PR that is opened against the `main` branch
release:
- base-branch: 'main'
32 changes: 16 additions & 16 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Greetings
on: [pull_request_target, issues]
jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Congratulations on your first issue! We will look into it!"
pr-message: "Congratulations on your first PR! We will be reviewing it! "
name: Greetings

on: [pull_request_target, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Congratulations on your first issue! We will look into it!'
pr-message: 'Congratulations on your first PR! We will be reviewing it! '
49 changes: 24 additions & 25 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler

name: Labeler
on: [pull_request_target]

jobs:
label:

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add label
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
# This workflow will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# To use this workflow, you will need to set up a .github/labeler.yml
# file with configuration. For more information, see:
# https://github.com/actions/labeler

name: Labeler
on: [pull_request_target]

jobs:
label:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Add label
uses: actions/labeler@v5
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
67 changes: 33 additions & 34 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
schedule:
- cron: '36 0 * * *'

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
exempt-issue-labels: Not Stale
exempt-pr-labels: Not Stale
stale-issue-message: >
This issue is stale because it has been open for 60 days with no
activity.
stale-pr-message: >
This pull request is stale because it has been open for 60 days
with no activity.
days-before-close: -1
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
schedule:
- cron: '36 0 * * *'

jobs:
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
exempt-issue-labels: Not Stale
exempt-pr-labels: Not Stale
stale-issue-message: >
This issue is stale because it has been open for 60 days with no
activity.
stale-pr-message: >
This pull request is stale because it has been open for 60 days
with no activity.
days-before-close: -1
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ yarn build
yarn dev
```

***Note***: A cloud-based Firebase project must still exist in order to run the emulator locally in this manner. Simply create a blank/empty [Firebase](https://firebase.google.com/) project using a Google account for this purpose, and then populate file `website/.env` accordingly with corresponding API key and project information from Firebase (see `website/example.env` for additional reference, as well as `website/__seed__/README.md` for more information regarding seeding a cloud-based Firebase Firestore database).
> [!NOTE]
> A cloud-based Firebase project must still exist in order to run the emulator locally in this manner. Simply create a blank/empty [Firebase](https://firebase.google.com/) project using a Google account for this purpose, and then populate file `website/.env` accordingly with corresponding API key and project information from Firebase (see `website/example.env` for additional reference, as well as `website/__seed__/README.md` for more information regarding seeding a cloud-based Firebase Firestore database).

Open `http://localhost:3000` with your browser to see the result. The local data will be seeded from scratch. Furthermore, you can use the local auth service by simply logging in via any of the provided services (e.g., Google) with auto-generated credentials, which will simulate a logged in user account.

Expand Down
16 changes: 10 additions & 6 deletions __seed__/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ recentsData

reviewsData
/{courseId}
/{year}-{SemesterTerm}/data: <TPayloadReviews>
/{year}-{SemesterTerm}
/data: <TPayloadReviews>

usersData
/{userId}: <User>
```

***N.B.*** The canonical path format for Firebase Firestore is `{collectionName}/{documentId}/{subCollectionName}/{subDocumentId}/...` and so on, with the path terminating at a (sub)document.
> [!NOTE]
> The canonical path format for Firebase Firestore is `{collectionName}/{documentId}/{subCollectionName}/{subDocumentId}/...` and so on, with the path terminating at a (sub)document.

## Seeding a Firebase project

***Note***: All paths indicated in this section are relative to the top-level directory (i.e., `website`). Furthermore, all commands (i.e., `yarn ...`) should also be issued from the top-level directory accordingly.
> [!NOTE]
> All paths indicated in this section are relative to the top-level directory (i.e., `website`). Furthermore, all commands (i.e., `yarn ...`) should also be issued from the top-level directory accordingly.

### Seeding or updating a cloud Firebase project

Expand All @@ -35,7 +37,8 @@ To seed the data in a development cloud-based Firebase Firestore database, defin
yarn fb:seed-db-cloud
```

***NOTE***: Do **NOT** use this method in **production**!!! Production Firebase database must be updated manually via the Firebase UI/console; otherwise, this seeding approach will wipe all of the live data **without** ability to recover it!
> [!WARNING]
> Do **NOT** use this method in **production**!!! Production Firebase database must be updated manually via the Firebase UI/console; otherwise, this seeding approach will wipe all of the live data **without** ability to recover it!

### Seeding or updating local *Firebase Emulator Suite*

Expand Down Expand Up @@ -78,7 +81,8 @@ This will update the corresponding files in directory `/__seed__/firebase-seed`.

## Adding a new course

***Note***: All paths indicated here are relative to the top-level directory (i.e., `website`).
> [!NOTE]
> All paths indicated here are relative to the top-level directory (i.e., `website`).

To add a new course, update the following files:

Expand Down
Loading
Loading