-
Notifications
You must be signed in to change notification settings - Fork 107
Develop #222
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
base: 1.2.0.1
Are you sure you want to change the base?
Develop #222
Changes from all commits
c402430
b88cd0c
fd0a34a
fe19259
30915d0
9b4e7c6
794e499
8bc8f82
51c2b7c
16fa0cb
92d0483
989c7b5
42eb0ad
18a4925
087a8a1
83aa54a
c47d403
f02cfa9
0433e27
d225b6d
1192006
be9ce61
0d6ccf4
4dddf21
1590a8b
6a8b33f
901a41b
05102af
3b16e06
286237b
9a1012e
335ba0a
799d092
06666c4
e75a408
da85459
a2eb990
ab9ab3b
061a247
b019ec6
784222b
f58c3ae
62a5884
ae305f7
98a0393
f3722e0
41be44b
1c0889a
fff9e9d
fb37615
04ddc9b
a7761f5
17b7436
83d5ca7
458e0d4
3b83a50
39992f4
9d75c37
1ecb235
f887d40
1072646
790f2f6
7c2af98
907bd6b
202b62b
971eef9
9f1aaab
a161c85
f8a3639
b150f0d
1df435a
ca9e54d
fd351bc
50f3a88
5f6b37b
7726eb4
29a6106
a4fe9bf
3672ba1
0a38c7f
9f639e5
af64a15
cdd2247
527f6fe
b77129a
485b6df
3d8c6d7
0e5ccff
3b5da67
231c356
2de9da1
ca41682
029925f
19a70af
a4b6a6b
d8db540
4fb3402
66bae35
8422c24
f0b1b8b
ac95e36
a7fbbf6
57d84e1
e03da3d
051dfbc
f155d0a
8b587f8
621c15a
4492e61
f753f96
6452bae
2f986ae
2bca234
996cba1
cfeb72f
ac688cb
624ab61
537e697
0bffae1
2a5f715
2d25d33
dee6ad0
658ed0f
55d67a9
0876b95
1f11dca
779e58b
184f3f5
a0fcb94
7709477
3e07e24
a972d74
59a86e2
b93f787
2592b25
399a6b2
f18be9a
9b60eca
969e481
dda94a0
83e0b7d
b191cf4
61233e3
3eb0f3d
e579bb6
aabdba0
6c850f5
d73a980
1ce7391
016171e
d55a5fe
73bd9f4
471e01d
6280cc9
7ed1429
9f1e1e8
9c0b0eb
c190535
ec551c1
2398b89
1883c10
d445773
3000dc1
5461d23
dffb18b
480d388
f7ba130
8540113
7796168
f98a703
3a05f26
4f92e17
acc24fb
f63a04c
ee79466
304af91
41c9a56
29d1860
f6a27a8
dc3c43f
19ebe4d
4e2cad3
93f5ba6
919ce76
87c3a31
85fccbb
494d709
076d552
99223f6
cc9b97e
d23636d
6bd4643
ab55fd4
64671be
15dd27e
3e09df5
b3a85a9
8157dc7
b50c64d
ba86bba
bef9b71
6b2bcb0
60975de
c0e65d8
19a7ef9
ad4f1b3
157314b
8164920
3baefaf
f7075c0
6417dd2
1d8e8ca
c39f9ec
9b3d84b
968267d
b0d5e7f
6de6b76
1541b61
037764d
395de2f
322100b
aa7e367
673249c
e5a2032
53a7892
cd3e846
dcedef0
04b000f
66d4143
489bb61
5e87808
ed265c1
236989c
eaa739e
148ac23
58f5d5a
db76fb7
9cb2e23
2f66628
22e6bc1
08db638
b1634f9
02eceda
be1a0b3
9077fbc
d76514f
39455d5
863d68c
b053ee1
4adf16e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| name: Setup Postgresql & Run postgres_init for MOSIP_Master & Run docker container | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| workflow_dispatch: | ||
| inputs: | ||
| message: | ||
| description: 'Message for manually triggering' | ||
| required: false | ||
| default: 'Triggered for Updates' | ||
| type: string | ||
| push: | ||
| branches: | ||
| - develop | ||
| - 1.2.0.1 | ||
| - MOSIP* | ||
| env: | ||
| DBUSER_PWD: mosip123 | ||
| SU_USER_PWD: abc123 | ||
| jobs: | ||
| setup-and-run: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v2 | ||
| - name: Create Docker Network | ||
| run: docker network create mosip_network | ||
| - name: Setup PostgreSQL Container | ||
| run: | | ||
| echo "[DB] Starting PostgreSQL container..." | ||
| docker run -d \ | ||
| --name postgresql \ | ||
| --network mosip_network \ | ||
| -p 5432:5432 \ | ||
| -e POSTGRES_USER=postgres \ | ||
| -e POSTGRES_PASSWORD=${{ env.SU_USER_PWD }} \ | ||
| -e POSTGRES_HOST_AUTH_METHOD=trust \ | ||
| postgres:16 | ||
| echo "[DB] PostgreSQL container started." | ||
|
|
||
| - name: Wait for PostgreSQL to be ready | ||
| run: | | ||
| echo "[DB] Waiting for PostgreSQL to accept connections..." | ||
| for i in $(seq 1 30); do | ||
| if docker exec postgresql pg_isready -U postgres -q; then | ||
| echo "[DB] PostgreSQL is ready after ${i} attempt(s)." | ||
| break | ||
| fi | ||
| echo "[DB] Attempt $i/30 - not ready yet, retrying in 2s..." | ||
| sleep 2 | ||
| done | ||
| docker exec postgresql pg_isready -U postgres || \ | ||
| (echo "[DB] ERROR: PostgreSQL did not become ready in time." && exit 1) | ||
|
|
||
| - name: Initialise mosip_master DB | ||
| run: | | ||
| echo "[DB] Starting mosip_master_container (postgres-init)..." | ||
| docker run -itd \ | ||
| --name mosip_master_container \ | ||
| --network mosip_network \ | ||
| -e MOSIP_DB_NAME=mosip_master \ | ||
| -e DB_SERVERIP=postgresql \ | ||
| -e DB_PORT=5432 \ | ||
| -e DEFAULT_DB_NAME=postgres \ | ||
| -e DB_UNAME=masteruser \ | ||
| -e DB_SCRIPTS_DIR=mosip_master \ | ||
| -e SU_USER=postgres \ | ||
| -e DML_FLAG=1 \ | ||
| -e GIT_REPO_URL=https://github.com/mosip/admin-services.git \ | ||
| -e GIT_BRANCH=develop \ | ||
| -e SU_USER_PWD=${{ env.SU_USER_PWD }} \ | ||
| -e DBUSER_PWD=${{ env.DBUSER_PWD }} \ | ||
| mosipdev/postgres-init:develop | ||
| echo "[DB] mosip_master_container launched." | ||
|
|
||
| - name: docker ps command | ||
| run: docker ps -a | ||
|
|
||
| - name: Stream mosip_master_container logs | ||
| run: | | ||
| echo "[DB] Streaming mosip_master_container logs (live)..." | ||
| docker logs -f mosip_master_container | ||
| echo "[DB] mosip_master_container has exited." | ||
|
|
||
| - name: Verify mosip_master_container exit code | ||
| run: | | ||
| EXIT_CODE=$(docker inspect mosip_master_container --format='{{.State.ExitCode}}') | ||
| echo "[DB] mosip_master_container exit code: $EXIT_CODE" | ||
| if [ "$EXIT_CODE" != "0" ]; then | ||
| echo "[DB] ERROR: mosip_master_container exited with non-zero code $EXIT_CODE" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check whether db_init has errors in Logs | ||
| run: | | ||
| echo "[DB] Scanning mosip_master_container logs for errors..." | ||
| if docker logs mosip_master_container 2>&1 | grep -qiE "\berror\b|\bfatal\b"; then | ||
| echo "[DB] ERROR: Problem keywords found in mosip_master_container logs:" | ||
| docker logs mosip_master_container 2>&1 | grep -iE "\berror\b|\bfatal\b" | ||
| exit 1 | ||
| else | ||
| echo "[DB] No errors found in mosip_master_container logs." | ||
| fi | ||
|
|
||
| - name: Verify masteruser role exists | ||
| run: | | ||
| echo "[DB] Verifying masteruser role exists in PostgreSQL..." | ||
| ROLE=$(docker exec postgresql psql -U postgres -tAc "SELECT rolname FROM pg_roles WHERE rolname='masteruser';") | ||
| if [ "$ROLE" = "masteruser" ]; then | ||
| echo "[DB] masteruser role confirmed." | ||
| else | ||
| echo "[DB] ERROR: masteruser role not found. DB init may have failed." | ||
| echo "[DB] Existing roles:" | ||
| docker exec postgresql psql -U postgres -c "\du" | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
| - name: Set environment variables | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "pull_request" ]; then | ||
| REPO_URL="${{ github.event.pull_request.head.repo.clone_url }}" | ||
| BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
| else | ||
| REPO_URL="https://github.com/${{ github.repository }}.git" | ||
| BRANCH_NAME="${{ github.ref_name }}" | ||
| fi | ||
| echo "REPO_URL=${REPO_URL}" >> $GITHUB_ENV | ||
| echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV | ||
|
|
||
| - name: Run masterdata-loader | ||
| run: | | ||
| docker run -itd \ | ||
| --name masterdata_loader \ | ||
| --network mosip_network \ | ||
| -e DB_HOST=postgresql \ | ||
| -e DB_USER=masteruser \ | ||
| -e DB_PORT=5432 \ | ||
| -e DB_PWD=${{ env.DBUSER_PWD }} \ | ||
| -e REPOSITORY=${{ env.REPO_URL }}\ | ||
| -e BRANCH=${{ env.BRANCH_NAME }} \ | ||
| mosipdev/masterdata-loader:develop | ||
|
|
||
| - name: docker ps command | ||
| run: docker ps -a | ||
| - name: Print Logs of masterdata_loader | ||
| run: | | ||
| # Display masterdata_loader logs | ||
| docker logs -f masterdata_loader | ||
|
|
||
| - name: Check whether masterdata_loader has errors in Logs | ||
| run: | | ||
| echo "[DB] Scanning masterdata_loader logs for errors..." | ||
| if docker logs masterdata_loader 2>&1 | grep -qiE "\berror\b|\bfatal\b"; then | ||
| echo "[DB] ERROR: Problem keywords found in masterdata_loader logs:" | ||
| docker logs masterdata_loader 2>&1 | grep -iE "\berror\b|\bfatal\b" | ||
| exit 1 | ||
| else | ||
| echo "[DB] No errors found in masterdata_loader logs." | ||
| fi | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: xlsx to csv conversion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request_target: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| types: [opened, reopened, synchronize] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: 'Message for manually triggering' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default: 'Triggered for Updates' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| convert_xlsx_to_csv: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Check for xlsx changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: check_xlsx | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_NUMBER=${{ github.event.number }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FILES=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Accept: application/vnd.github.v3+json" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/files") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| XLSX_CHANGED=$(echo "$FILES" | jq '[.[].filename | select(endswith(".xlsx"))] | length') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "xlsx_changed=$XLSX_CHANGED" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Skip if no xlsx changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed == '0' && github.event_name != 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "No xlsx files changed. Skipping workflow." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Clone the repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git clone -b ${{ github.event.pull_request.head.ref }} https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Code injection Critical
Potential code injection in
${ github.event.pull_request.head.ref } Error loading related location Loading pull_request_target Error loading related location Loading
Copilot AutofixAI 28 days ago Use GitHub Actions’ safe pattern for untrusted input in
Best minimal fix in
This preserves behavior while preventing expression-time injection in shell script text.
Suggested changeset
1
.github/workflows/xlsx-to-csv.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Get author email | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_NUMBER=${{ github.event.number }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| commits=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -H "Accept: application/vnd.github.v3+json" \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/commits") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| email=$(echo "$commits" | jq -r '.[0].commit.author.email // "${{ github.event.pull_request.user.login }}@users.noreply.github.com"') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "author_email=$email" >> $GITHUB_ENV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Set up Git identity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git config --global user.name "${{ github.event.pull_request.user.login }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git config --global user.email "${{ env.author_email }}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install xlsx2csv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: sudo apt-get install -y xlsx2csv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Create output directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf mosip-data/mosip_master_csv/csv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p mosip-data/mosip_master_csv/csv | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Convert all XLSX to CSV | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for xlsx_file in mosip-data/mosip_master/xlsx/*.xlsx; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| csv_file="mosip-data/mosip_master_csv/csv/$(basename "${xlsx_file%.xlsx}.csv")" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| xlsx2csv "$xlsx_file" > "$csv_file" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Converted $xlsx_file to $csv_file" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Commit and push changes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: steps.check_xlsx.outputs.xlsx_changed != '0' || github.event_name == 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cd mosip-data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git branch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git add . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git commit -s -m "Added converted CSV files" || echo "No changes to commit" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| git push "https://x-access-token:${{ secrets.ACTION_PAT }}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git" HEAD:${{ github.event.pull_request.head.ref }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Check failureCode scanning / CodeQL Code injection Critical
Potential code injection in
${ github.event.pull_request.head.ref } Error loading related location Loading pull_request_target Error loading related location Loading
Copilot AutofixAI 28 days ago Use GitHub’s recommended safe pattern: assign untrusted context values to environment variables in the step, then reference them via shell variables (e.g.,
This keeps functionality unchanged while removing direct expression interpolation from the shell command and properly quoting the refspec argument.
Suggested changeset
1
.github/workflows/xlsx-to-csv.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
Comment on lines
+15
to
+80
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Copilot AutofixAI 28 days ago Add an explicit Best minimal, non-functional-change fix:
This preserves existing behavior because writes are done through
Suggested changeset
1
.github/workflows/xlsx-to-csv.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| .DS_Store | ||
| .idea | ||
| .project |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # AGENTS.md | ||
|
|
||
| This file provides guidance to AI agents when working with code in this repository. | ||
|
|
||
| ## What This Repository Is | ||
|
|
||
| This is the **MOSIP Master Data Repository** — a data-only repo containing sample/sandbox master data for the [MOSIP identity platform](https://docs.mosip.io/1.2.0/id-lifecycle-management). It has no application code, no build system, and no test suite. Changes here feed directly into MOSIP database initialization and upgrades. | ||
|
|
||
| ## Data Layout | ||
|
|
||
| ``` | ||
| mosip_master/xlsx/ ← Canonical source: 37 Excel files (edit these) | ||
| mosip_master/csv/ ← Primary CSV source used by the masterdata-loader | ||
| mosip_master_csv/csv/ ← Auto-generated from xlsx via CI (do not edit manually) | ||
| mosip_master/data_upgrade/ ← Version-to-version delta migration scripts | ||
| ``` | ||
|
|
||
| **Key rule:** Only edit files in `mosip_master/xlsx/` or `mosip_master/csv/`. The `mosip_master_csv/csv/` directory is regenerated automatically by the `xlsx-to-csv` GitHub Actions workflow on every PR — manual edits there will be overwritten. | ||
|
|
||
| ## Workflows | ||
|
|
||
| ### xlsx-to-csv (`.github/workflows/xlsx-to-csv.yml`) | ||
| Triggers on PR open/sync or manual `workflow_dispatch`. Converts every `.xlsx` in `mosip_master/xlsx/` to CSV using `xlsx2csv` and commits the result into `mosip_master_csv/csv/` on the PR branch. Requires the `ACTION_PAT` secret. | ||
|
|
||
| To trigger manually: GitHub → Actions → "xlsx-to-csv" → Run workflow. | ||
|
|
||
| ### push-trigger (`.github/workflows/push-trigger.yml`) | ||
| Validates the full data load pipeline end-to-end: | ||
| 1. Spins up PostgreSQL 16 in Docker | ||
| 2. Runs `mosipdev/postgres-init:develop` to create the `mosip_master` schema | ||
| 3. Runs `mosipdev/masterdata-loader:develop` to load CSV data from this repo | ||
| 4. Checks for loader errors | ||
|
|
||
| This is the closest thing to a "test" for this repo. A passing run confirms the data is loadable. | ||
|
|
||
| ## Data Entities | ||
|
|
||
| The master data covers: | ||
|
|
||
| | Domain | Key files | | ||
| |---|---| | ||
| | Identity | `identity_schema`, `ui_spec`, `dynamic_field` | | ||
| | Templates | `template`, `template_type` | | ||
| | Devices | `device_master`, `device_spec`, `device_type` | | ||
| | Machines | `machine_master`, `machine_spec`, `machine_type` | | ||
| | Locations | `location`, `loc_hierarchy_list`, `zone`, `zone_user` | | ||
| | Registration | `registration_center`, `reg_center_type`, `reg_working_nonworking` | | ||
| | Documents | `valid_document`, `doc_category`, `doc_type`, `applicant_valid_document` | | ||
| | Lookup | `language`, `title`, `reason_list`, `blocklisted_words` | | ||
|
|
||
| **`identity_schema.csv`** is the most complex file — it embeds full JSON Schema Draft-07 definitions inside CSV cells. Each row is one schema version per language (e.g. `eng, 1001, 0.1, ...`). Schema ID 1001 = standard identity; 1002 = Mosip Identity for handle. | ||
|
|
||
| ## Data Upgrade Scripts | ||
|
|
||
| `mosip_master/data_upgrade/` contains **delta** migrations (not full datasets) between MOSIP versions: | ||
|
|
||
| - `1.1.5.5_to_1.2.0.1/` — Dynamic field format changed (array → object per language); UI spec split into separate table; new machine/template types | ||
| - `1.2.0.1_to_1.3.0/` — Template additions and updates only | ||
|
|
||
| **To run an upgrade:** | ||
| ```bash | ||
| cd mosip_master/data_upgrade/<version>/ | ||
| cp upgrade.properties upgrade.local.properties | ||
| # Fill in DB_SERVERIP, SU_USER_PWD, UPGRADE_DOMAIN_NAME, admin creds, language codes | ||
| bash upgrade.sh upgrade.local.properties | ||
| ``` | ||
|
|
||
| The Python helper scripts (`data-uploader.py`, `migration-ui_spec.py`, `migration-dynamicfield.py`) authenticate against the MOSIP Admin API and/or connect directly to PostgreSQL. They are invoked by `upgrade.sh` via `upgrade_commands.txt`. | ||
|
|
||
| ## Masterdata Reference | ||
|
|
||
| Full field definitions and valid values: https://docs.mosip.io/1.2.0/id-lifecycle-management/support-systems/administration/masterdata-guide |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| THIRD-PARTY NOTICES | ||
|
|
||
| Copyright © MOSIP. | ||
| All rights reserved. | ||
|
|
||
| This project includes third-party components distributed under licenses | ||
| that require attribution. The following sections list those components | ||
| and their respective licenses. | ||
|
|
||
| =========================== | ||
| Mozilla Public License 2.0 | ||
| ========================== | ||
|
|
||
| • MOSIP Data (mosip-data) | ||
| Version: release-1.3.x | ||
| Homepage: [https://github.com/Rakshithasai123/mosip-data](https://github.com/Rakshithasai123/mosip-data) | ||
|
|
||
| =========================== | ||
| MIT License | ||
| =========== | ||
|
|
||
| • actions/checkout | ||
| Version: 2.*.* | ||
| Homepage: [https://github.com/actions/checkout](https://github.com/actions/checkout) | ||
|
|
||
| --- | ||
|
|
||
| Full license texts for all components are available in the | ||
| `license/` directory of this repository. | ||
| ---------------------------------------- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,19 @@ | ||
| # Sample Data | ||
|
|
||
| ## Overview | ||
| This repo contains data that is uploaded into MOSIP during [sandbox installation](https://docs.mosip.io/1.2.0/deployment/sandbox-deployment). The data needs to be reviewed and modified for a country specific deployment. Refer to [Masterdata Guide](https://docs.mosip.io/1.2.0/deployment/masterdata-guide). | ||
| This repo contains data that is uploaded into MOSIP during [sandbox installation](https://docs.mosip.io/1.2.0/setup/deploymentnew/getting-started#mosip-installations). The data needs to be reviewed and modified for a country specific deployment. Refer to [Masterdata Guide](https://docs.mosip.io/1.2.0/id-lifecycle-management/support-systems/administration/masterdata-guide). | ||
|
|
||
| ## For Build and Run | ||
| Data initialization is performed through the **Master Data Loader** as part of the [postgres-init](https://github.com/mosip/postgres-init/tree/release-1.3.x) repository. | ||
|
|
||
| ## Contribution & Community | ||
|
|
||
| • To learn how you can contribute code to this application, [click here](https://docs.mosip.io/1.2.0/community/code-contributions). | ||
|
|
||
| • If you have questions or encounter issues, visit the [MOSIP Community](https://community.mosip.io/) for support. | ||
|
|
||
| • For any GitHub issues: [Report here](https://github.com/mosip/mosip-data/issues) | ||
|
|
||
| ## License | ||
| This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE). | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| THIRD-PARTY-NOTICES | ||
|
|
||
| This project includes third-party packages that are distributed under various open-source licenses. Below is a list of packages and their associated licenses. | ||
|
|
||
| ================================================================================ | ||
| Package: actions/checkout | ||
| Version: 2.*.* | ||
| License: MIT License | ||
| Homepage: https://github.com/actions/checkout | ||
| ================================================================================ | ||
|
|
||
| ================================================================================ | ||
| Package: PostgreSQL (Docker Official Image) | ||
| Version: 16 | ||
| License: PostgreSQL License | ||
| Homepage: https://hub.docker.com/_/postgres | ||
| ================================================================================ | ||
|
|
||
| Full license texts and additional details for each of the above packages are available in the license/ directory of this repository. Please refer to those files or the original source of each package for complete legal terms and conditions. |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI about 1 month ago
Add an explicit
permissionsblock in.github/workflows/push-trigger.ymlat the workflow root (top-level), so it applies to all jobs unless overridden.The least-privilege fix for this workflow is:
permissions:contents: readThis preserves existing behavior (checkout still works) while ensuring the token is not implicitly overprivileged.