Skip to content

Commit 1faa9fd

Browse files
committed
chore(clients): add workflow to auto-close PR
1 parent da95580 commit 1faa9fd

12 files changed

+41
-0
lines changed

generators/src/main/java/com/algolia/codegen/AlgoliaCSharpGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public void processOpts() {
124124
supportingFiles.add(new SupportingFile("LICENSE", "../", "LICENSE"));
125125
supportingFiles.add(new SupportingFile("issue.yml", "../.github/workflows", "issue.yml"));
126126
supportingFiles.add(new SupportingFile("Bug_report.yml", "../.github/ISSUE_TEMPLATE", "Bug_report.yml"));
127+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", "../.github/workflows/", "do-not-edit-this-repository.yml"));
127128

128129
reservedWords.removeIf(word -> word.equals("Configuration"));
129130
}

generators/src/main/java/com/algolia/codegen/AlgoliaDartGenerator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public void processOpts() {
104104
supportingFiles.add(new SupportingFile("LICENSE", "../client_core/", "LICENSE"));
105105
supportingFiles.add(new SupportingFile("issue.yml", "../../.github/workflows", "issue.yml"));
106106
supportingFiles.add(new SupportingFile("Bug_report.yml", "../../.github/ISSUE_TEMPLATE", "Bug_report.yml"));
107+
supportingFiles.add(
108+
new SupportingFile("do-not-edit-this-repository.yml", "../../.github/workflows/", "do-not-edit-this-repository.yml")
109+
);
107110

108111
// Search config
109112
additionalProperties.put("isSearchClient", client.equals("search"));

generators/src/main/java/com/algolia/codegen/AlgoliaGoGenerator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public void processOpts() {
5757
supportingFiles.add(new SupportingFile("LICENSE", "../../", "LICENSE"));
5858
supportingFiles.add(new SupportingFile("issue.yml", "../../.github/workflows", "issue.yml"));
5959
supportingFiles.add(new SupportingFile("Bug_report.yml", "../../.github/ISSUE_TEMPLATE", "Bug_report.yml"));
60+
supportingFiles.add(
61+
new SupportingFile("do-not-edit-this-repository.yml", "../../.github/workflows/", "do-not-edit-this-repository.yml")
62+
);
6063

6164
try {
6265
additionalProperties.put("packageVersion", Helpers.getClientConfigField("go", "packageVersion"));

generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public void processOpts() {
5858
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
5959
supportingFiles.add(new SupportingFile("issue.yml", ".github/workflows", "issue.yml"));
6060
supportingFiles.add(new SupportingFile("Bug_report.yml", ".github/ISSUE_TEMPLATE", "Bug_report.yml"));
61+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", ".github/workflows/", "do-not-edit-this-repository.yml"));
6162

6263
reservedWords.removeIf(word -> word.equals("configuration"));
6364

generators/src/main/java/com/algolia/codegen/AlgoliaJavascriptGenerator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public void processOpts() {
6464
supportingFiles.add(new SupportingFile("LICENSE", "", "../../LICENSE"));
6565
supportingFiles.add(new SupportingFile("issue.yml", "../../.github/workflows", "issue.yml"));
6666
supportingFiles.add(new SupportingFile("Bug_report.yml", "../../.github/ISSUE_TEMPLATE", "Bug_report.yml"));
67+
supportingFiles.add(
68+
new SupportingFile("do-not-edit-this-repository.yml", "../../.github/workflows/", "do-not-edit-this-repository.yml")
69+
);
6770

6871
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
6972

generators/src/main/java/com/algolia/codegen/AlgoliaKotlinGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public void processOpts() {
115115
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
116116
supportingFiles.add(new SupportingFile("issue.yml", ".github/workflows", "issue.yml"));
117117
supportingFiles.add(new SupportingFile("Bug_report.yml", ".github/ISSUE_TEMPLATE", "Bug_report.yml"));
118+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", ".github/workflows/", "do-not-edit-this-repository.yml"));
118119

119120
additionalProperties.put("packageVersion", Helpers.getClientConfigField("kotlin", "packageVersion"));
120121
}

generators/src/main/java/com/algolia/codegen/AlgoliaPhpGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void processOpts() {
5454
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
5555
supportingFiles.add(new SupportingFile("issue.yml", ".github/workflows", "issue.yml"));
5656
supportingFiles.add(new SupportingFile("Bug_report.yml", ".github/ISSUE_TEMPLATE", "Bug_report.yml"));
57+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", ".github/workflows/", "do-not-edit-this-repository.yml"));
5758

5859
additionalProperties.put("isSearchClient", client.equals("search"));
5960
additionalProperties.put("configClassname", getClientName(client) + "Config");

generators/src/main/java/com/algolia/codegen/AlgoliaPythonGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public void processOpts() {
9090
supportingFiles.add(new SupportingFile("LICENSE", "../", "LICENSE"));
9191
supportingFiles.add(new SupportingFile("issue.yml", "../.github/workflows", "issue.yml"));
9292
supportingFiles.add(new SupportingFile("Bug_report.yml", "../.github/ISSUE_TEMPLATE", "Bug_report.yml"));
93+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", "../.github/workflows/", "do-not-edit-this-repository.yml"));
9394
}
9495

9596
@Override

generators/src/main/java/com/algolia/codegen/AlgoliaRubyGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public void processOpts() {
4545
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
4646
supportingFiles.add(new SupportingFile("issue.yml", ".github/workflows", "issue.yml"));
4747
supportingFiles.add(new SupportingFile("Bug_report.yml", ".github/ISSUE_TEMPLATE", "Bug_report.yml"));
48+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", ".github/workflows/", "do-not-edit-this-repository.yml"));
4849

4950
// Remove some files we don't want to output or change their paths
5051
supportingFiles.removeIf(

generators/src/main/java/com/algolia/codegen/AlgoliaScalaGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public void processOpts() {
7878
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
7979
supportingFiles.add(new SupportingFile("issue.yml", ".github/workflows", "issue.yml"));
8080
supportingFiles.add(new SupportingFile("Bug_report.yml", ".github/ISSUE_TEMPLATE", "Bug_report.yml"));
81+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", ".github/workflows/", "do-not-edit-this-repository.yml"));
8182

8283
additionalProperties.put("isSearchClient", client.equals("search"));
8384
typeMapping.put("AnyType", "Any");

generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public void processOpts() {
200200
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
201201
supportingFiles.add(new SupportingFile("issue.yml", ".github/workflows", "issue.yml"));
202202
supportingFiles.add(new SupportingFile("Bug_report.yml", ".github/ISSUE_TEMPLATE", "Bug_report.yml"));
203+
supportingFiles.add(new SupportingFile("do-not-edit-this-repository.yml", ".github/workflows/", "do-not-edit-this-repository.yml"));
203204

204205
supportingFiles.add(new SupportingFile("Package.mustache", "Package.swift"));
205206
supportingFiles.add(new SupportingFile("podspec.mustache", projectName + ".podspec"));
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Do not edit files in this repository
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopen
9+
branches:
10+
- 'main'
11+
12+
jobs:
13+
auto_close_pr:
14+
name: Close PR
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Close PR
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
PR_NUMBER: ${{ github.event.pull_request.number }}
23+
run: |
24+
gh pr close "${PR_NUMBER}" -d -c "Thanks for contributing to our API clients! Sorry to close your PR, but this repository is fully generated, you can port your changes to [the API Clients Automation repository](https://github.com/algolia/api-clients-automation). If you need some guidance, feel free to [open an issue](https://github.com/algolia/api-clients-automation/issues) or [read our contribution guide](https://api-clients-automation.netlify.app/docs/introduction)."

0 commit comments

Comments
 (0)