@@ -11,12 +11,42 @@ jobs:
11
11
name : Stainless — Upload OpenAPI specification
12
12
steps :
13
13
- uses : actions/checkout@v4
14
+
15
+ - name : Check for "Skip Readme"
16
+ id : check_rdme
17
+ uses : actions/github-script@v6
18
+ with :
19
+ script : |
20
+ const { context } = require('@actions/github');
21
+ const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
22
+
23
+ // Get the list of PRs merged into the current commit
24
+ const { data: prs } = await octokit.rest.repos.listPullRequestsAssociatedWithCommit({
25
+ owner: context.repo.owner,
26
+ repo: context.repo.repo,
27
+ commit_sha: context.sha,
28
+ });
29
+
30
+ // Check if any PR has the "Skip Readme" label
31
+ if (prs.length > 0) {
32
+ const pr = prs[0]; // Assume the first PR is the relevant one
33
+ const hasIgnoreLabel = pr.labels.some(label => label.name === 'Skip Readme');
34
+ return hasIgnoreLabel;
35
+ }
36
+ return false;
37
+ result-encoding : string
38
+
39
+ # Upload OpenAPI spec to Stainless
14
40
- uses : stainless-api/upload-openapi-spec-action@main
15
41
with :
16
42
stainless_api_key : ${{ secrets.STAINLESS_API_KEY }}
17
43
input_path : ' openapi.yaml'
18
44
output_path : ' openapi.documented.yaml'
19
45
project_name : ' TogetherAI'
20
- - uses : readmeio/rdme@v8
46
+
47
+ # Conditionally run the rdme step
48
+ - name : Update Readme docs
49
+ if : steps.check_rdme.outputs.result != 'true'
50
+ uses : readmeio/rdme@v8
21
51
with :
22
52
rdme : openapi "openapi.yaml" --key=${{ secrets.README_TOKEN }} --id=${{ secrets.README_DEFINITION_ID }}
0 commit comments