]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ari-stubs: Fix more local anchor references
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 5 Sep 2023 19:02:19 +0000 (13:02 -0600)
committerGeorge Joseph <gjoseph@sangoma.com>
Tue, 5 Sep 2023 19:35:03 +0000 (13:35 -0600)
Also allow CreateDocs job to be run manually with default branches.

.github/workflows/CreateDocs.yml
rest-api-templates/api.wiki.mustache
rest-api-templates/swagger_model.py

index 1882500b2471c69b5efcfa7b4d8e85eac39fe50a..0417849adfa558743541a23bb61d5137e76a298f 100644 (file)
@@ -4,7 +4,7 @@ on:
     inputs:
       branches:
         description: "JSON array of branches: ['18','20'] (no spaces)"
-        required:    true
+        required:    false
         type:        string
   schedule:
 #           Times are UTC
@@ -14,15 +14,29 @@ env:
   ASTERISK_REPO:     ${{ github.repository }}
   GITHUB_TOKEN:      ${{ secrets.GITHUB_TOKEN }}
   GH_TOKEN:          ${{ secrets.GITHUB_TOKEN }}
+  DEFAULT_BRANCHES:  ${{ vars.WIKIDOC_BRANCHES }}
+  INPUT_BRANCHES:    ${{ inputs.branches }}
 
 jobs:
+  
   CreateDocsDebug:
     runs-on: ubuntu-latest
+    outputs:
+      manual_branches:     ${{ steps.setup.outputs.manual_branches }}
     steps:
+      - name: setup
+        run: |
+          MANUAL_BRANCHES="$INPUT_BRANCHES"
+          [ -z "$MANUAL_BRANCHES" ] && MANUAL_BRANCHES="$DEFAULT_BRANCHES" || :
+          echo "manual_branches=${MANUAL_BRANCHES}"
+          echo "manual_branches=${MANUAL_BRANCHES}" >>${GITHUB_OUTPUT}
+          exit 0
+        
       - name: DumpEnvironment
         uses: asterisk/asterisk-ci-actions/DumpEnvironmentAction@main
         with:
-          action-vars: ${{toJSON(inputs)}}
+          action-inputs: ${{toJSON(inputs)}}
+          action-vars: ${{ toJSON(steps.setup.outputs) }}
 
   CreateDocsScheduledMatrix:
     needs: [ CreateDocsDebug ]
@@ -73,7 +87,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        branch: ${{ fromJSON(inputs.branches) }}
+        branch: ${{ fromJSON(vars.WIKIDOC_MANUAL_BRANCHES) }}
     runs-on: ubuntu-latest
     steps:
       - name: CreateDocs for ${{matrix.branch}}
index ba96d99ad2cc888ddb416a48dcfdf692768c38cf..c40ca803d5b1047489e618dc70b0237fdaa522f3 100644 (file)
@@ -5,14 +5,14 @@
 |:------ |:------------------------------------ |:------------ |:------- |
 {{#apis}}
 {{#operations}}
-| {{http_method}} | [{{wiki_path}}](#{{nickname}}) | {{#response_class}}{{#is_primitive}}{{name}}{{/is_primitive}}{{^is_primitive}}[{{wiki_name}}]({{wiki_prefix}}Asterisk_REST_Data_Models#{{lc_singular_name}}){{/is_primitive}}{{/response_class}} | {{{summary}}} |
+| {{http_method}} | [{{wiki_path}}](#{{nickname_lc}}) | {{#response_class}}{{#is_primitive}}{{name}}{{/is_primitive}}{{^is_primitive}}[{{wiki_name}}]({{wiki_prefix}}Asterisk_REST_Data_Models#{{lc_singular_name}}){{/is_primitive}}{{/response_class}} | {{{summary}}} |
 {{/operations}}
 {{/apis}}
 {{#apis}}
 {{#operations}}
 
 ---
-[//]: # (anchor:{{nickname}})
+[//]: # (anchor:{{nickname_lc}})
 ## {{nickname}}
 ### {{http_method}} {{wiki_path}}
 {{{wiki_summary}}}{{#wiki_notes}} {{{wiki_notes}}}{{/wiki_notes}}
index 680be7fe300db4e8ccf8c583efb6ab1f31ddfde6..23dcb8cbf1b8c3b4a02d508a1c00e50637d3dd73 100644 (file)
@@ -367,6 +367,7 @@ class Operation(Stringify):
     def __init__(self):
         self.http_method = None
         self.nickname = None
+        self.nickname_lc = None
         self.response_class = None
         self.parameters = []
         self.summary = None
@@ -378,6 +379,7 @@ class Operation(Stringify):
         validate_required_fields(op_json, self.required_fields, context)
         self.http_method = op_json.get('httpMethod')
         self.nickname = op_json.get('nickname')
+        self.nickname_lc = self.nickname.lower() 
         response_class = op_json.get('responseClass')
         self.response_class = response_class and SwaggerType().load(
             response_class, processor, context)