Alerting: Fix contact point update and diff logic (#2305) #69
This file contains hidden or 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: create schema update PR | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'internal/**' | |
- 'pkg/**' | |
- 'go.mod' | |
- 'go.sum' | |
jobs: | |
create-schema-update-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Required to commit changes | |
pull-requests: write # Required to create PRs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Go | |
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 | |
with: | |
go-version-file: go.mod | |
- name: Set up Terraform | |
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | |
- name: Generate current schema | |
run: | | |
go build . | |
./scripts/generate_schema.sh > current_schema.json | |
- name: Check for schema changes | |
id: schema-check | |
run: | | |
# Compare with committed schema if it exists | |
if [ -f "provider_schema.json" ]; then | |
if ! diff -q provider_schema.json current_schema.json > /dev/null; then | |
echo "schema_changed=true" >> $GITHUB_OUTPUT | |
echo "Schema changes detected!" | |
else | |
echo "schema_changed=false" >> $GITHUB_OUTPUT | |
echo "No schema changes detected." | |
fi | |
else | |
echo "schema_changed=true" >> $GITHUB_OUTPUT | |
echo "Required provider_schema.json file not found" | |
fi | |
- name: Update schema and templates | |
if: steps.schema-check.outputs.schema_changed == 'true' | |
run: | | |
# Update the provider schema | |
cp current_schema.json provider_schema.json | |
# Update templates | |
go run scripts/generate_issue_template.go --update-schema | |
- name: Create Pull Request with schema updates | |
if: steps.schema-check.outputs.schema_changed == 'true' | |
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: | | |
chore: update provider schema and issue templates | |
Auto-generated by schema consistency workflow | |
title: 'chore: update provider schema and issue templates' | |
body: | | |
## Automated Schema Update | |
This PR was automatically created because recent changes to the codebase affected the Terraform provider schema. | |
### Changes Made: | |
- Updated `provider_schema.json` with latest schema definitions | |
- Updated `.github/ISSUE_TEMPLATE/3-bug-report-enhanced.yml` with new schema options | |
### Triggered By: | |
- **Commit**: ${{ github.sha }} | |
- **Message**: ${{ github.event.head_commit.message }} | |
- **Author**: ${{ github.event.head_commit.author.name }} | |
--- | |
🤖 *This PR was created automatically by the schema consistency workflow. Please review the changes before merging.* | |
branch: 'automated/update-schema' | |
delete-branch: true | |
base: main | |
committer: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>' | |
author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>' |