1
- name : enforce schema consistency
1
+ name : create schema update PR
2
2
3
3
on :
4
- pull_request :
4
+ push :
5
+ branches :
6
+ - main
5
7
paths :
6
8
- ' internal/**'
7
9
- ' pkg/**'
8
10
- ' go.mod'
9
11
- ' go.sum'
10
12
11
13
jobs :
12
- enforce -schema-consistency :
14
+ create -schema-update-pr :
13
15
runs-on : ubuntu-latest
14
16
permissions :
15
- pull-requests : write
16
- contents : read
17
+ contents : write # Required to commit changes
18
+ pull-requests : write # Required to create PRs
17
19
steps :
18
20
- name : Checkout
19
21
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20
22
with :
21
- persist-credentials : false
23
+ token : ${{ secrets.GITHUB_TOKEN }}
22
24
23
25
- name : Set up Go
24
26
uses : actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
27
29
28
30
- name : Set up Terraform
29
31
uses : hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
30
- with :
31
- terraform_version : " 1.12.2" # Ensure to use the same in generate_schema.sh
32
32
33
33
- name : Generate current schema
34
34
run : |
@@ -52,46 +52,43 @@ jobs:
52
52
echo "Required provider_schema.json file not found"
53
53
fi
54
54
55
- - name : Update templates
55
+ - name : Update schema and templates
56
56
if : steps.schema-check.outputs.schema_changed == 'true'
57
57
run : |
58
+ # Update the provider schema
59
+ cp current_schema.json provider_schema.json
60
+
61
+ # Update templates
58
62
go run scripts/generate_issue_template.go --update-schema
59
63
60
- - name : Comment on PR
64
+ - name : Create Pull Request with schema updates
61
65
if : steps.schema-check.outputs.schema_changed == 'true'
62
- uses : actions/github-script@v7
66
+ uses : peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
63
67
with :
64
- script : |
65
- const comment = `## 🔧 Schema Update Required
68
+ token : ${{ secrets.GITHUB_TOKEN }}
69
+ commit-message : |
70
+ chore: update provider schema and issue templates
66
71
67
- This PR introduces changes that affect the Terraform provider schema. The issue templates need to be updated.
72
+ Auto-generated by schema consistency workflow
73
+ title : ' chore: update provider schema and issue templates'
74
+ body : |
75
+ ## Automated Schema Update
68
76
69
- ### 📋 Required Action
77
+ This PR was automatically created because recent changes to the codebase affected the Terraform provider schema.
70
78
71
- Please run the generator to update templates:
79
+ ### Changes Made:
80
+ - Updated `provider_schema.json` with latest schema definitions
81
+ - Updated `.github/ISSUE_TEMPLATE/3-bug-report-enhanced.yml` with new schema options
72
82
73
- \`\`\`bash
74
- make generate-templates
75
- \`\`\`
76
-
77
- Then commit the updated files:
78
- - \`provider_schema.json\`
79
- - \`.github/ISSUE_TEMPLATE/3-bug-report-enhanced.yml\`
83
+ ### Triggered By:
84
+ - **Commit**: ${{ github.sha }}
85
+ - **Message**: ${{ github.event.head_commit.message }}
86
+ - **Author**: ${{ github.event.head_commit.author.name }}
80
87
81
88
---
82
- *This comment was generated automatically because schema changes were detected.*`;
83
-
84
- github.rest.issues.createComment({
85
- issue_number: context.issue.number,
86
- owner: context.repo.owner,
87
- repo: context.repo.repo,
88
- body: comment
89
- });
90
-
91
- - name : Fail if schema changes detected
92
- if : steps.schema-check.outputs.schema_changed == 'true'
93
- run : |
94
- echo "❌ Schema changes detected - blocking merge until templates are updated"
95
- echo "Run: make generate-templates"
96
- echo "Then commit the updated files"
97
- exit 1
89
+ 🤖 *This PR was created automatically by the schema consistency workflow. Please review the changes before merging.*
90
+ branch : ' automated/update-schema'
91
+ delete-branch : true
92
+ base : main
93
+ committer : ' github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
94
+ author : ' github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
0 commit comments