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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "assets"]
path = assets
url = https://github.com/IFRCGo/go-api-artifacts
url = git@github.com:IFRCGo/go-api-artifacts.git
71 changes: 71 additions & 0 deletions docs/go-artifacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,74 @@ docker compose run --rm serve ./manage.py spectacular --file .assets/openapi-sch
- In `go-api`
- **Update the submodule reference** in your `go-api` PR.
- In the corresponding **`go-api` Pull Request**, include the link to the `go-api-artifacts` PR as a *related PR* so reviewers can track both changes together.

## Submodule Pointer Workflow

Keep CI green by ensuring the parent repo points to a submodule commit that exists on the remote.

- Update submodule content and push:
```bash
cd assets
git checkout -b update-artifacts
# make changes (e.g., regenerate schema)
git add -A
git commit -m "Update artifacts"
git push origin update-artifacts
# open PR in IFRCGo/go-api-artifacts and merge to main
git checkout main && git pull
cd -
```
- Record new submodule commit in parent:
```bash
# ensure the submodule worktree is on the merged commit
cd assets && git checkout main && git pull && cd -
git add assets
git commit -m "Update assets submodule pointer"
git push origin <your-go-api-branch>
```
- GitHub Actions checkout settings (recommended):
```yaml
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
```

Notes
- Avoid amending/rebasing submodule commits that the parent already references; make a new commit instead.
- Ensure submodule commit is on `origin/main` (or a ref CI can fetch) before updating the parent pointer.

## Submodule Commands Cheat Sheet

Common commands you’ll use with `assets` submodule:

- Initialize submodules after clone:
```bash
git submodule update --init --recursive
```
- Sync `.gitmodules` config to local submodule metadata:
```bash
git submodule sync
```
- Move submodule to latest commit from its remote tracking branch:
```bash
git submodule update --remote assets
git add assets
git commit -m "Sync assets to latest remote commit"
```
- Pin submodule to a specific commit (e.g., after checkout):
```bash
cd assets
git checkout <commit-or-branch>
cd -
git add assets
git commit -m "Update assets submodule pointer"
```
- Switch submodule remote to SSH (avoid HTTPS prompts):
```bash
git config -f .gitmodules submodule.assets.url git@github.com:IFRCGo/go-api-artifacts.git
git submodule sync
cd assets && git remote set-url origin git@github.com:IFRCGo/go-api-artifacts.git && cd -
git add .gitmodules assets
git commit -m "Use SSH for artifacts submodule"
```
4 changes: 4 additions & 0 deletions main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@
url(r"^api/v2/secondarysector", ProjectSecondarySectors.as_view()),
url(r"^api/v2/projectstatus", ProjectStatuses.as_view()),
url(r"^api/v2/learningtype", LearningTypes.as_view()),
# Consolidated PER endpoints
url(r"^api/v2/per-map-data", per_views.PerMapDataView.as_view()),
url(r"^api/v2/per-assessments-processed", per_views.PerAssessmentsProcessedView.as_view()),
url(r"^api/v2/per-dashboard-data", per_views.PerDashboardDataView.as_view()),
# url(r"^api/v2/create_field_report/", api_views.CreateFieldReport.as_view()),
# url(r"^api/v2/update_field_report/(?P<pk>\d+)/", api_views.UpdateFieldReport.as_view()),
url(r"^get_auth_token", GetAuthToken.as_view()),
Expand Down
Loading
Loading