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

SGID Index Validation #2692

Merged
merged 5 commits into from
Mar 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
8 changes: 8 additions & 0 deletions .github/SGID_INDEX_ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: SGID Index Validation Issues
labels: sgid index validation
---

Validation errors have been detected in the [SGID Index](https://docs.google.com/spreadsheets/d/11ASS7LnxgpnD0jN4utzklREgMf1pcvYjcXcIcESHweQ/edit#gid=1024261148). This issue will be used to track the resolution of these issues.

GitHub Actions should post a comment with the details shortly...
125 changes: 125 additions & 0 deletions .github/workflows/schedule.sgid-index-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Schedule (SGID Index Validation)

on:
schedule:
- cron: '0 0 * * 1-5'
workflow_dispatch:
issue_comment:
types: [created, edited]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
issues: write

jobs:
validate:
name: Validate SGID Index
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/scripts
env:
GOOGLE_PRIVATE_KEY: ${{ secrets.SA }}

steps:
- name: ✅ Check comment
if: github.event_name == 'issue_comment'
run: |
if [[ "${{ github.event.comment.body }}" == "/validate-sgid-index" ]]; then
echo "Validating SGID Index"
else
echo "Skipping SGID Index validation"
exit 78
fi

- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false

- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm

- name: 📦 Install script dependencies
run: npm install

- name: ✔ Running script
uses: gh640/command-result-action@v1
id: validate
with:
command: node validate-sgid-index.mjs
cwd: ./src/scripts

- name: 📝 Create issue
id: create-issue
if: steps.validate.outputs.exitCode != 0
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/SGID_INDEX_ISSUE_TEMPLATE.md
update_existing: true

- name: Find Open Issues
uses: actions/github-script@v4
id: find-issue
if: steps.validate.outputs.exitCode == 0
with:
script: |
const { data: issues } = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: 'sgid index validation'
});
const issueNumber = issues[0]?.number;
console.log('issueNumber: ' + issueNumber);

return issueNumber;
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Find Comment
uses: peter-evans/find-comment@v3
if: steps.create-issue.outputs.number || steps.find-issue.outputs.result
id: find-comment
with:
issue-number: ${{ steps.create-issue.outputs.number || steps.find-issue.outputs.result }}
comment-author: github-actions[bot]
body-includes: Validation Output

- name: ✍️ Updating issue comment
if: steps.create-issue.outputs.number || steps.find-issue.outputs.result
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.create-issue.outputs.number || steps.find-issue.outputs.result }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |
### SGID Index Validation Output

#### Results
```
${{ steps.validate.outputs.stdout }}
```

#### Errors
${{ steps.validate.outputs.stderr }}

- name: 🚦 Check for errors
if: steps.validate.outputs.exitCode != 0
run: |
echo "::error::Validate stderr${{ steps.validate.outputs.stderr }}"
exit ${{ steps.validate.outputs.exitCode }}

- name: 🎉 Close issue
if: steps.validate.outputs.exitCode == 0 && steps.find-issue.outputs.result
run: gh issue close --comment "All validations have passed successfully" "${{ steps.find-issue.outputs.result }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
"oil",
"oiland",
"opendata",
"opensgid",
"Oquirrh",
"Orangeville",
"Orderville",
Expand Down
28 changes: 15 additions & 13 deletions src/data/downloadMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const dataPages: DownloadMetadata = {
itemId: 'abd5d645b0e144558d0ab15e1f043490',
name: 'BLM Wilderness Study Areas for Utah',
featureServiceId: 'Wilderness_BLMWSAs',
openSgid: 'boundaries.blm_wilderness_study_areas_for_utah',
openSgid: 'planning.blm_wilderness_study_areas_for_utah',
layerId: 0,
},
'Utah Navajo Chapters': {
Expand Down Expand Up @@ -740,7 +740,7 @@ export const dataPages: DownloadMetadata = {
openSgid: 'energy.oil_gas_fields',
layerId: 0,
featureServiceHost: 'https://services.arcgis.com/ZzrwjTRez6FJiOq4/ArcGIS/rest/services/',
oddHubName: 'utah-oil-and-gas-fields'
oddHubName: 'utah-oil-and-gas-fields',
},
'Utah Energy Corridor Areas': {
itemId: '3c39e10f78c34cd981f28bde8ad76e14',
Expand Down Expand Up @@ -1267,9 +1267,11 @@ export const dataPages: DownloadMetadata = {
layerId: 0,
},
'Utah Quaternary Faults': {
itemId: 'hosted by UGS',
itemId: '9c85978d0fb54570bc60bec467e2fa7f',
name: 'Utah Quaternary Faults',
featureServiceId: 'QuaternaryFaults',
featureServiceHost: 'https://services.arcgis.com/ZzrwjTRez6FJiOq4/arcgis',
featureServiceId: 'Utah_Quaternary_Faults_20201207',
externalHubOrganization: 'utahDNR',
openSgid: 'geoscience.quaternary_faults',
layerId: 0,
},
Expand Down Expand Up @@ -1878,7 +1880,7 @@ export const dataPages: DownloadMetadata = {
'Utah US Congress Districts 2022 to 2032': {
itemId: 'b5ef0b24f994467fb4f22b27b1a47e25',
name: 'Utah US Congress Districts 2022 to 2032',
featureServiceId: 'USCongressDistricts2022to2032 ',
featureServiceId: 'USCongressDistricts2022to2032',
openSgid: 'political.us_congress_districts_2022_to_2032',
layerId: 0,
},
Expand Down Expand Up @@ -2088,14 +2090,14 @@ export const dataPages: DownloadMetadata = {
'Utah Broadband Service': {
itemId: '2b479a30791c445eb135e05acf77dbcc',
name: 'Utah Broadband Service',
featureServiceId: 'BroadBandService',
featureServiceId: 'BroadbandService',
openSgid: 'utilities.broadband_service',
layerId: 0,
},
'Utah Streams NHD': {
itemId: 'd9b5ac9220ff415994b193c9ce022f86',
name: 'Utah Streams NHD',
featureServiceId: 'StreamsNHDHighRes',
featureServiceId: 'UtahStreamsNHD',
openSgid: 'water.streams_nhd',
layerId: 0,
},
Expand Down Expand Up @@ -2144,7 +2146,7 @@ export const dataPages: DownloadMetadata = {
'Utah Watersheds Area': {
itemId: 'eedaf451685b4cbe875ecf692e1b54ff',
name: 'Utah Watersheds Area',
featureServiceId: 'Watersheds_Area',
featureServiceId: 'UtahWatershedsArea',
openSgid: 'water.watersheds_area',
layerId: 0,
},
Expand Down Expand Up @@ -2368,8 +2370,8 @@ export const dataPages: DownloadMetadata = {
'Utah Health Small Statistical Areas Obesity and Activity': {
itemId: '5c5c709041d343f18096b7a356831be9',
name: 'Utah Health Small Statistical Areas Obesity and Activity',
featureServiceId: null,
openSgid: '',
featureServiceId: 'HealthSmallStatisticalAreas2020',
openSgid: 'health.health_small_statistical_areas_2020',
layerId: 0,
},
'Utah House Districts 2022 to 2032': {
Expand Down Expand Up @@ -2424,7 +2426,7 @@ export const dataPages: DownloadMetadata = {
'Utah School Board Districts 2022 to 2032': {
itemId: 'ebb7b8e8a0104b448d3bbf3ee82a5580',
name: 'Utah School Board Districts 2022 to 2032',
featureServiceId: 'UtahSchoolBoardDistricts2022to2032 ',
featureServiceId: 'UtahSchoolBoardDistricts2022to2032',
openSgid: 'political.school_board_districts_2022_to_2032',
layerId: 0,
},
Expand Down Expand Up @@ -2571,15 +2573,15 @@ export const dataPages: DownloadMetadata = {
'Utah Senate Districts 2022 to 2032': {
itemId: '5289f23d9e76421f89d9a9ef4864937a',
name: 'Utah Senate Districts 2022 to 2032',
featureServiceId: 'UtahSenateDistricts2022to2032 ',
featureServiceId: 'UtahSenateDistricts2022to2032',
openSgid: 'political.senate_districts_2022_to_2032',
layerId: 0,
},
'Utah Health Small Statistical Areas 2020': {
itemId: '67edfe9ded464e3393c1932b4d39a6b2',
name: 'Utah Health Small Statistical Areas 2020',
featureServiceId: 'HealthSmallStatisticalAreas2020',
openSgid: 'health_small_statistical_areas_2020',
openSgid: 'health.health_small_statistical_areas_2020',
layerId: 0,
},
'Utah Tax Areas 2021': {
Expand Down
1 change: 1 addition & 0 deletions src/scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.cache
Loading