Skip to content

Commit

Permalink
feat: sgid index validation
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Mar 22, 2024
1 parent bb1f70c commit 2d5a298
Show file tree
Hide file tree
Showing 8 changed files with 814 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/SGID_INDEX_ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: SGID Index Validation Issues
---

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...
93 changes: 93 additions & 0 deletions .github/workflows/schedule.sgid-index-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Schedule (SGID Index Validation)

on:
schedule:
- cron: '0 0 * * 1-5'
workflow_dispatch:

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_APPLICATION_CREDENTIALS: ${{ secrets.SA }}

steps:
- 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 Comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ steps.create-issue.outputs.number }}
comment-author: 'github-actions[bot]'
body-includes: output

- name: ✍️ Updating issue comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.create-issue.outputs.number }}
comment-id: validation-output
body: |
### SGID Index Validation Output
#### `stdout`
```
${{ steps.validate.outputs.stdout }}
```
#### `stderr`
```
${{ 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.create-issue.outputs.number
run: gh issue close --comment "Auto-closing issue" "${{ steps.create-issue.outputs.number }}"
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
Loading

0 comments on commit 2d5a298

Please sign in to comment.