Event Gather - on manual run, from and to ISO dates are required, not optional #136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Instance Configuration Validation Bot | |
on: | |
issues: | |
types: | |
- opened | |
- edited | |
jobs: | |
validate-form: | |
if: ${{ contains(github.event.issue.labels.*.name, 'new instance') }} | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
######################################################################### | |
# Initial Hello and Documentation | |
- name: Find Validation Results Comment - Pre Run | |
uses: peter-evans/find-comment@v2 | |
id: find-validation-results-comment-pre | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: 'Form Validation Results' | |
- name: Set Initial Comment State | |
uses: peter-evans/create-or-update-comment@v3 | |
if: ${{ steps.find-validation-results-comment-pre.outputs.comment-id == 0 }} | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Hello! 👋 | |
Thanks for initiating the process to configure a new CDP instance. | |
I am a bot that will validate the information provided in your form. If any check fails, please update your issue by opening the '⋯' dropdown in the top-right-corner of your GitHub Issue and selecting 'Edit'. I will automatically rerun the checks after you update the issue to validate the changes. | |
A member from the CDP team will respond as soon as possible! | |
#### Form Validation Results | |
:hourglass_flowing_sand: Validating planned instance maintainer | |
:hourglass_flowing_sand: Validating planned instance repository name | |
:hourglass_flowing_sand: Determining event scraper strategy and optionally testing Legistar | |
#### All Cookiecutter Parameters | |
:hourglass_flowing_sand: Generating... | |
_This comment was written by a bot!_ | |
- name: Reset Initial Comment State | |
uses: peter-evans/create-or-update-comment@v3 | |
if: ${{ steps.find-validation-results-comment-pre.outputs.comment-id != 0 }} | |
with: | |
comment-id: ${{ steps.find-validation-results-comment-pre.outputs.comment-id }} | |
edit-mode: 'replace' | |
body: | | |
Hello! 👋 | |
Thanks for initiating the process to configure a new CDP instance. | |
I am a bot that will validate the information provided in your form. If any check fails, please update your issue by opening the '⋯' dropdown in the top-right-corner of your GitHub Issue and selecting 'Edit'. I will automatically rerun the checks after you update the issue to validate the changes. | |
A member from the CDP team will respond as soon as possible! | |
#### Form Validation Results | |
:hourglass_flowing_sand: Validating planned instance maintainer | |
:hourglass_flowing_sand: Validating planned instance repository name | |
:hourglass_flowing_sand: Determining event scraper strategy and optionally testing Legistar | |
#### All Cookiecutter Parameters | |
:hourglass_flowing_sand: Generating... | |
_This comment was written by a bot!_ | |
######################################################################### | |
# Workflow Setup | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install Bot Scripts Dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r .github/workflows/scripts/requirements.txt | |
######################################################################### | |
# Parsing Form and Logging Details | |
- name: Dump Issue Body to File | |
run: | | |
echo "${{ github.event.issue.body }}" > issue-body.md | |
- name: Validate Form and Create Bot Response | |
run: | | |
python .github/workflows/scripts/validate_form.py issue-body.md | |
- name: Set Response Content | |
id: validation-message-response | |
run: | | |
body=$(cat form-validation-results.md) | |
body="${body//'%'/'%25'}" | |
body="${body//$'\n'/'%0A'}" | |
body="${body//$'\r'/'%0D'}" | |
echo ::set-output name=body::"$body" | |
- name: Dump Cookiecutter Parameters | |
id: dump-cookiecutter-parameters | |
run: | | |
set -f | |
body=$(cat planned-cookiecutter.json) | |
body="${body//'%'/'%25'}" | |
body="${body//$'\n'/'%0A'}" | |
body="${body//$'\r'/'%0D'}" | |
echo ::set-output name=body::$body | |
- name: Get Infrastructure Metadata | |
id: infra-meta | |
run: | | |
slug=$(jq -r '.municipality_slug' planned-cookiecutter.json) | |
infra_slug=$(jq -r '.infrastructure_slug' planned-cookiecutter.json) | |
region=$(jq -r '.firestore_region' planned-cookiecutter.json) | |
echo "::set-output name=slug::$slug" | |
echo "::set-output name=infra_slug::$infra_slug" | |
echo "::set-output name=region::$region" | |
- name: Find Validation Results Comment - Post Run | |
uses: peter-evans/find-comment@v2 | |
id: find-validation-results-comment-post | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: 'Form Validation Results' | |
- name: Post Validation Results | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.find-validation-results-comment-post.outputs.comment-id }} | |
edit-mode: 'replace' | |
body: | | |
Hello! 👋 | |
Thanks for initiating the process to configure a new CDP instance. | |
I am a bot that will validate the information provided in your form. If any check fails, please update your issue by opening the '⋯' dropdown in the top-right-corner of your GitHub Issue and selecting 'Edit'. I will automatically rerun the checks after you update the issue to validate the changes. | |
A member from the CDP team will respond as soon as possible! | |
#### Form Validation Results | |
${{ steps.validation-message-response.outputs.body }} | |
#### All Cookiecutter Parameters | |
```json | |
${{ steps.dump-cookiecutter-parameters.outputs.body }} | |
``` | |
--- | |
#### Steps for Internal CDP Team | |
To proceed with the deployment process, please do the following: | |
* [ ] Run `get_cdp_infrastructure_stack dev-infrastructure/` | |
* [ ] Run `just login` in cdp-backend/dev-infrastructure and login to the CDP gcloud account | |
* [ ] Run `just init ${{ steps.infra-meta.outputs.infra_slug }}` in cdp-backend/dev-infrastructure | |
* [ ] Run `just setup ${{ steps.infra-meta.outputs.infra_slug }} ${{ steps.infra-meta.outputs.region }}` in cdp-backend/dev-infrastructure | |
* [ ] Setup Firebase Storage [Link](https://console.firebase.google.com/u/0/project/${{ steps.infra-meta.outputs.infra_slug }}/storage) | |
* [ ] Comment "/cdp-deploy" on this issue and follow the rest of the instructions | |
More details on the `just` commands can be found in [cdp-backend](https://github.com/CouncilDataProject/cdp-backend/tree/main/dev-infrastructure). | |
_This comment was written by a bot!_ | |
- name: Find Infrastructure Slug Comment | |
uses: peter-evans/find-comment@v2 | |
id: find-infra-slug-comment | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: 'Generated Infrastructure Slug' | |
- name: Set Initial Infra Slug Comment State | |
uses: peter-evans/create-or-update-comment@v3 | |
if: ${{ steps.find-infra-slug-comment.outputs.comment-id == 0 }} | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
##### Generated Infrastructure Slug | |
`${{ steps.infra-meta.outputs.infra_slug }}` | |
_This comment was written by a bot!_ | |
- name: Reset Infra Slug Comment State | |
uses: peter-evans/create-or-update-comment@v3 | |
if: ${{ steps.find-infra-slug-comment.outputs.comment-id != 0 }} | |
with: | |
comment-id: ${{ steps.find-infra-slug-comment.outputs.comment-id }} | |
edit-mode: 'replace' | |
body: | | |
##### Generated Infrastructure Slug | |
`${{ steps.infra-meta.outputs.infra_slug }}` | |
_This comment was written by a bot!_ |