Skip to content

Commit 558435c

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix-shape-anywhere-events
2 parents 965930b + 41bbed9 commit 558435c

68 files changed

Lines changed: 2416 additions & 1614 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// ArcGIS Portal REST API — Search reference:
2+
// https://developers.arcgis.com/rest/users-groups-and-items/search-reference.htm
3+
const API_URL =
4+
'https://geoportal.un.org/arcgis/sharing/rest/search?f=json&q=(type:%22geojson%22)%20AND%20(title:%22*geodata*%22)&sortField=modified&sortOrder=desc';
5+
6+
export default async function checkUnGeodata({ github, context, core }) {
7+
// Fetch the UN Geodata API
8+
const res = await fetch(API_URL);
9+
if (!res.ok) throw new Error(`API request failed: ${res.status}`);
10+
const data = await res.json();
11+
const newest = data.results[0];
12+
if (!newest) throw new Error('No results returned from API');
13+
14+
const marker = `<!-- un-geodata-modified:${newest.modified} -->`;
15+
16+
// Check if we already created an issue for this modified timestamp
17+
const { data: issues } = await github.rest.issues.listForRepo({
18+
owner: context.repo.owner,
19+
repo: context.repo.repo,
20+
labels: 'topojson',
21+
state: 'all',
22+
sort: 'created',
23+
direction: 'desc',
24+
per_page: 100
25+
});
26+
27+
if (issues.some((issue) => issue.body?.includes(marker))) {
28+
core.info('No new updates — issue already exists for this timestamp');
29+
return;
30+
}
31+
32+
// Build the issue body
33+
const summary = data.results
34+
.map((r) => {
35+
const date = new Date(r.modified).toISOString().slice(0, 10);
36+
return `- **${r.title}** (modified: ${date}, id: \`${r.id}\`)`;
37+
})
38+
.join('\n');
39+
40+
const body = [
41+
marker,
42+
'',
43+
`The [UN Geoportal geodata API](${API_URL}) has new or updated artifacts.`,
44+
'',
45+
`### Datasets found (${data.total}):`,
46+
summary,
47+
'',
48+
'### Next steps',
49+
'- Review the updated dataset at the [UN Geoportal](https://geoportal.un.org/)',
50+
'- Determine if `topojson/` sources need updating',
51+
'',
52+
'---',
53+
`*This issue was created automatically by the [Check UN Geodata Updates](${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/workflows/check-un-geodata.yml) workflow.*`
54+
].join('\n');
55+
56+
await github.rest.issues.create({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
title: `UN Geodata update detected: ${newest.title}`,
60+
body,
61+
labels: ['topojson']
62+
});
63+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Check UN Geodata Updates
2+
3+
on:
4+
schedule:
5+
# First day of every month at 09:00 UTC
6+
- cron: '0 9 1 * *'
7+
workflow_dispatch:
8+
9+
permissions:
10+
issues: write
11+
12+
jobs:
13+
check-geodata:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
17+
with:
18+
sparse-checkout: .github/scripts
19+
20+
- name: Check for UN Geodata updates
21+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
22+
with:
23+
script: |
24+
const { default: checkUnGeodata } = await import('${{ github.workspace }}/.github/scripts/check-un-geodata.mjs');
25+
await checkUnGeodata({ github, context, core });

.github/workflows/ci.yml

Lines changed: 0 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -575,123 +575,6 @@ jobs:
575575
# ============================================================
576576
# Standalone jobs (no dependencies on install-and-cibuild)
577577
# ============================================================
578-
publish-dist:
579-
runs-on: ubuntu-latest
580-
steps:
581-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
582-
with:
583-
fetch-depth: 0
584-
fetch-tags: true
585-
586-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
587-
with:
588-
node-version: ${{ env.NODE_VERSION }}
589-
cache: 'npm'
590-
591-
- name: Set up build environment
592-
run: .github/scripts/env_build.sh
593-
594-
- name: Preview CHANGELOG for next release (only on master)
595-
if: github.ref == 'refs/heads/master'
596-
run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true
597-
598-
- name: Set draft version in package.json
599-
run: |
600-
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
601-
602-
- name: View package.json diff between previous and next releases
603-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
604-
605-
- name: Build dist/
606-
run: npm run build
607-
608-
# Upload library uncompressed to allow for testing in REPLs
609-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
610-
name: Upload uncompressed plotly.js built from PR, using Node 22
611-
with:
612-
retention-days: 30
613-
archive: false
614-
path: dist/plotly.js
615-
616-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
617-
name: Upload Node 18 archive of plotly.js build folder
618-
with:
619-
name: dist-node18
620-
retention-days: 7
621-
path: dist/
622-
623-
- name: View dist/README.md diff between previous and next releases
624-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true
625-
626-
- name: Preview plot-schema diff (only on master)
627-
if: github.ref == 'refs/heads/master'
628-
run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true
629-
630-
- name: Test plot-schema.json diff
631-
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
632-
633-
publish-dist-node-v22:
634-
runs-on: ubuntu-latest
635-
steps:
636-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
637-
with:
638-
fetch-depth: 0
639-
fetch-tags: true
640-
641-
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
642-
with:
643-
node-version: '22.14.0'
644-
cache: 'npm'
645-
646-
- name: Set up build environment
647-
run: .github/scripts/env_build.sh
648-
649-
- name: Preview CHANGELOG for next release (only on master)
650-
if: github.ref == 'refs/heads/master'
651-
run: npm run use-draftlogs && git --no-pager diff --color-words CHANGELOG.md || true
652-
653-
- name: Set draft version in package.json
654-
run: |
655-
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
656-
657-
- name: View package.json diff between previous and next releases
658-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
659-
660-
- name: Build dist/
661-
run: npm run build
662-
663-
# This is necessary to avoid a naming collision with the upload from the Node 18 build
664-
- name: Copy library for upload
665-
run: cp dist/plotly.js dist/plotly.node22.js
666-
667-
# Upload library uncompressed to allow for testing in REPLs
668-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
669-
name: Upload uncompressed plotly.js built from PR, using Node 22
670-
with:
671-
retention-days: 30
672-
archive: false
673-
path: dist/plotly.node22.js
674-
675-
- name: Remove copy of library
676-
run: rm dist/plotly.node22.js
677-
678-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
679-
name: Upload Node 22 archive of plotly.js build folder
680-
with:
681-
name: dist-node22
682-
retention-days: 7
683-
path: dist/
684-
685-
- name: View dist/README.md diff between previous and next releases
686-
run: git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) dist/README.md || true
687-
688-
- name: Preview plot-schema diff (only on master)
689-
if: github.ref == 'refs/heads/master'
690-
run: git --no-pager diff tags/$(git describe --tags --abbrev=0) dist/plot-schema.json || true
691-
692-
- name: Test plot-schema.json diff
693-
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
694-
695578
test-stackgl-bundle:
696579
needs: detect-changes
697580
if: >-

.github/workflows/publish-dist.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish Dist
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
types:
8+
- opened
9+
- reopened
10+
- synchronize
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: publish-dist-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
publish-dist:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
22+
with:
23+
fetch-depth: 0
24+
fetch-tags: true
25+
26+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
27+
with:
28+
node-version: '18'
29+
cache: 'npm'
30+
31+
- name: Set up build environment
32+
run: .github/scripts/env_build.sh
33+
34+
- name: Set draft version in package.json
35+
run: |
36+
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
37+
# View package.json diff from last release (should show that the version has been changed to the draft version)
38+
git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
39+
40+
- name: Build dist/
41+
run: npm run build
42+
43+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
44+
name: Upload Node 18 archive of plotly.js build folder
45+
with:
46+
name: dist-node18
47+
retention-days: 7
48+
path: dist/
49+
50+
- name: Test plot-schema.json diff
51+
run: diff --unified --color dist/plot-schema.json test/plot-schema.json
52+
53+
publish-dist-node-v22:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
57+
with:
58+
fetch-depth: 0
59+
fetch-tags: true
60+
61+
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
62+
with:
63+
node-version: '22.14.0'
64+
cache: 'npm'
65+
66+
- name: Set up build environment
67+
run: .github/scripts/env_build.sh
68+
69+
- name: Set draft version in package.json
70+
run: |
71+
node --eval "var fs = require('fs'); var inOut = './package.json'; var data = JSON.parse(fs.readFileSync(inOut)); var a = process.argv; data.version = a[a.length - 1].replace('v', ''); fs.writeFileSync(inOut, JSON.stringify(data, null, 2) + '\n');" $(git describe)
72+
# View package.json diff from last release (should show that the version has been changed to the draft version)
73+
git --no-pager diff --color-words tags/$(git describe --tags --abbrev=0) package.json || true
74+
75+
- name: Build dist/
76+
run: npm run build
77+
78+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
79+
name: Upload Node 22 archive of plotly.js build folder
80+
with:
81+
name: dist-node22
82+
retention-days: 7
83+
path: dist/
84+
85+
- name: Test plot-schema.json diff
86+
run: diff --unified --color dist/plot-schema.json test/plot-schema.json

0 commit comments

Comments
 (0)