Skip to content
Open
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
20 changes: 20 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,24 @@ Before submitting your PR, there are a few things you can do to make sure it goe
- [ ] Ensure the linter passes (`./codeAnalysis` to automatically apply formatting/linting)
- [ ] Appropriate docs were updated (if necessary)

## 📸 Proof of change (REQUIRED)

> **Every PR must include a screen recording / video showing the change working.**
> **UI changes must also include before/after screenshots.**
> Just drag-and-drop the files into the boxes below — GitHub will upload them.
> PRs without the required media will be flagged automatically and **cannot be merged**.

### 🎥 Screen recording / video (always required)

<!-- Drag a short screen recording (.mp4 / .mov / .webm) here, or paste a Loom/YouTube link. -->

### 🖼️ Screenshots (required for any UI change)

| Before | After |
| ------ | ----- |
| | |

- [ ] This change has **no user-visible / UI effect** (refactor, docs, CI, etc.), so screenshots are not applicable.
- A maintainer may also apply the `non-ui` label. **A video is still required** even for non-UI changes.

Fixes #<issue_number_goes_here> 🦕
129 changes: 129 additions & 0 deletions .github/workflows/require-pr-media.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Require PR media

# Ensures every PR includes a screen recording / video, and a screenshot for UI
# changes. Posts a friendly comment tagging the author when something is missing,
# and fails a status check so the PR cannot be merged until it is fixed.
#
# Escape hatch: apply the `non-ui` label (or tick the "no user-visible / UI effect"
# box in the PR description) to skip the screenshot requirement. A video is still
# required even for non-UI changes.

on:
pull_request_target:
types: [opened, edited, reopened, synchronize, labeled, unlabeled]

# pull_request_target runs in the base-repo context so we can comment on PRs from
# forks. We only read the PR body/labels and post a comment — no untrusted code is
# checked out or executed.
permissions:
pull-requests: write
issues: write

concurrency:
group: require-pr-media-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
check-media:
name: Check for screenshot & video
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const MARKER = '<!-- require-pr-media -->';
const pr = context.payload.pull_request;
const body = pr.body || '';
const author = pr.user.login;

// --- Detect a screenshot (an embedded image) --------------------
const hasScreenshot =
/!\[[^\]]*\]\([^)]+\)/.test(body) || // ![alt](url) markdown image
/<img\b[^>]*>/i.test(body); // <img ...> html

// Strip embedded images so their URLs are not mistaken for a video.
const withoutImages = body
.replace(/!\[[^\]]*\]\([^)]*\)/g, ' ')
.replace(/<img\b[^>]*>/gi, ' ');

// --- Detect a video --------------------------------------------
const hasVideo =
/\.(mp4|mov|webm|m4v|avi|mkv)\b/i.test(withoutImages) || // file extension
/<video[\s>]/i.test(withoutImages) || // <video> html
// A GitHub-hosted attachment that is NOT an embedded image is treated
// as a video (GitHub renders uploaded videos as a bare attachment URL).
/https?:\/\/(?:github\.com\/user-attachments\/assets|user-images\.githubusercontent\.com)\/\S+/i.test(withoutImages) ||
// Common external video hosts.
/https?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be|loom\.com|vimeo\.com|streamable\.com|drive\.google\.com)\/\S+/i.test(withoutImages);

// --- Is this a non-UI change? ----------------------------------
const labels = (pr.labels || []).map(l => l.name.toLowerCase());
const nonUiLabel = labels.some(n =>
['non-ui', 'no-ui', 'no-ui-change', 'non-ui-change'].includes(n));
const nonUiCheckbox =
/- \[x\][^\n]*no user-visible/i.test(body) ||
/- \[x\][^\n]*no\b[^\n]*ui\b/i.test(body);
const isNonUi = nonUiLabel || nonUiCheckbox;

// --- Work out what is missing ----------------------------------
const missing = [];
if (!hasVideo) {
missing.push('a **🎥 screen recording / video** demonstrating the change — **a video is required even when there are no UI changes**, to show that the parts of the app affected by this change still work');
}
if (!isNonUi && !hasScreenshot) {
missing.push('a **🖼️ screenshot** of the UI change (or mark the PR as `non-ui` if there is no UI change)');
}

// --- Compose the comment ---------------------------------------
let commentBody;
if (missing.length === 0) {
commentBody = [
MARKER,
`✅ Thanks @${author} — required media detected. Nothing more needed here!`,
].join('\n');
} else {
commentBody = [
MARKER,
`👋 Hi @${author}, thanks for the contribution!`,
'',
'Before this PR can be reviewed and merged, please add:',
'',
...missing.map(m => `- ${m}`),
'',
'Just drag-and-drop the file(s) into the PR description and GitHub will upload them. ' +
'This check re-runs automatically when you edit the description.',
'',
isNonUi
? '_This PR is marked as non-UI, so a screenshot is not required — **but a video is still required**, showing that the parts of the app affected by this change still work correctly._'
: '_If this change has no user-visible effect, tick the "no user-visible / UI effect" box in the description (or ask a maintainer to add the `non-ui` label) to skip the screenshot requirement. **A video is still required even with no UI changes**, to show that the affected parts of the app still work._',
].join('\n');
}

// --- Upsert the comment (avoid spamming on every edit) ---------
const { owner, repo } = context.repo;
const issue_number = pr.number;
const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number, per_page: 100,
});
const existing = comments.find(c => (c.body || '').includes(MARKER));

if (existing) {
await github.rest.issues.updateComment({
owner, repo, comment_id: existing.id, body: commentBody,
});
} else if (missing.length > 0) {
// Only create a brand-new comment when there is something to ask for.
await github.rest.issues.createComment({
owner, repo, issue_number, body: commentBody,
});
}

// --- Fail the check if media is missing ------------------------
if (missing.length > 0) {
core.setFailed(
'Missing required PR media: ' +
missing.map(m => m.replace(/\*\*/g, '').replace(/[🎥🖼️]/g, '').trim()).join('; '),
);
} else {
core.info('All required PR media present.');
}
131 changes: 59 additions & 72 deletions app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,161 +3,148 @@
"project_number": "422699885542",
"firebase_url": "https://tree-tracker-a7a13.firebaseio.com",
"project_id": "tree-tracker-a7a13",
"storage_bucket": "tree-tracker-a7a13.appspot.com"
"storage_bucket": "tree-tracker-a7a13.firebasestorage.app"
},
"client": [
{
{
"client_info": {
"mobilesdk_app_id": "1:422699885542:android:aab16ef8fc4e5968a0ec27",
"mobilesdk_app_id": "1:422699885542:android:e673ea9e40b77f6aa0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker.test"
"package_name": "com.ftt.android.TreeTracker"
}
},
"oauth_client": [
{
"client_id": "422699885542-pfodsarvr7gifkverfg33n4icu2vqidl.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.greenstand.android.TreeTracker.test",
"certificate_hash": "c06a47237965c9690d2f571f4e1ceb09b4efe52b"
}
},
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
},
{
{
"client_info": {
"mobilesdk_app_id": "1:422699885542:android:993c29134938ce4d",
"mobilesdk_app_id": "1:422699885542:android:dc800825e887261ea0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker"
}
},
"oauth_client": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
}
],
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:422699885542:android:993c29134938ce4d",
"mobilesdk_app_id": "1:422699885542:android:dc800825e887261ea0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker.dev"
"package_name": "org.greenstand.android.TreeTracker.prerelease"
}
},
"oauth_client": [
"oauth_client": [],
"api_key": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:422699885542:android:11ddac217a11a7f4a0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker.debug"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:422699885542:android:993c29134938ce4d",
"mobilesdk_app_id": "1:422699885542:android:0d0fe64a4522d006a0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker.debug"
"package_name": "org.greenstand.android.TreeTracker.dev"
}
},
"oauth_client": [
"oauth_client": [],
"api_key": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:422699885542:android:695c2cf8b13db668a0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker.justdiggit"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "422699885542-aec38c6t8ji3n81hfq5lhfnjde1hb58s.apps.googleusercontent.com",
"client_type": 3
}
]
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:301103308242:android:993c29134938ce4d",
"mobilesdk_app_id": "1:422699885542:android:aab16ef8fc4e5968a0ec27",
"android_client_info": {
"package_name": "org.greenstand.android.TreeTracker.prerelease"
"package_name": "org.greenstand.android.TreeTracker.test"
}
},
"oauth_client": [
{
"client_id": "301103308242-lrrl3ccujjvdjls8udg4oejqn57324ja.apps.googleusercontent.com",
"client_type": 3
"client_id": "422699885542-pfodsarvr7gifkverfg33n4icu2vqidl.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "org.greenstand.android.TreeTracker.test",
"certificate_hash": "c06a47237965c9690d2f571f4e1ceb09b4efe52b"
}
}
],
"api_key": [
{
"current_key": "AIzaSyDjQOMe8wZ68wgzfkwsA6tq87SEDPvHBN8"
"current_key": "AIzaSyC5u6w2W3zKwFRnMHxxPnje34Mc6R3jpno"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
Expand Down
Loading
Loading