@@ -11,12 +11,42 @@ jobs:
1111 name : Stainless — Upload OpenAPI specification
1212 steps :
1313 - 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
1440 - uses : stainless-api/upload-openapi-spec-action@main
1541 with :
1642 stainless_api_key : ${{ secrets.STAINLESS_API_KEY }}
1743 input_path : ' openapi.yaml'
1844 output_path : ' openapi.documented.yaml'
1945 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
2151 with :
2252 rdme : openapi "openapi.yaml" --key=${{ secrets.README_TOKEN }} --id=${{ secrets.README_DEFINITION_ID }}
0 commit comments