Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ai-rqc into test
  • Loading branch information
GuillaumeFalourd committed Apr 23, 2024
2 parents 4a2801d + 537cdb7 commit 37eb64f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/action-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
INPUT_DATA: ${{ steps.input_data.outputs.test }}

- name: Check Remote Quick Command answer
run: echo ${{ toJSON(steps.rqc.outputs.rqc_answer) }}
run: echo ${{ toJSON(steps.rqc.outputs.rqc_result) }}
2 changes: 1 addition & 1 deletion .github/workflows/action-test-ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ jobs:
INPUT_DATA: ${{ steps.input_data.outputs.test }}

- name: Check Remote Quick Command answer
run: echo ${{ toJSON(steps.rqc.outputs.rqc_answer) }}
run: echo ${{ toJSON(steps.rqc.outputs.rqc_result) }}
2 changes: 1 addition & 1 deletion .github/workflows/action-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
INPUT_DATA: ${{ steps.input_data.outputs.test }}

- name: Check Remote Quick Command answer
run: echo ${{ toJSON(steps.rqc.outputs.rqc_answer) }}
run: echo ${{ toJSON(steps.rqc.outputs.rqc_result) }}
shell: bash
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ steps:
INPUT_DATA: ${{ steps.input_data.outputs.<OUTPUT_NAME> }}

- name: Check Remote Quick Command answer
run: echo ${{ toJSON(steps.rqc.outputs.rqc_answer) }}
run: echo ${{ toJSON(steps.rqc.outputs.rqc_result) }}
```
## ▶️ Action Inputs
Expand All @@ -71,7 +71,7 @@ Field | Mandatory | Default Value | Observation
Field | Observation
------------ | -------------
**rqc_answer** | Can be accessed by using `${{ toJSON(steps.rqc.outputs.rqc_answer) }}`
**rqc_result** | Can be accessed by using `${{ toJSON(steps.rqc.outputs.rqc_result) }}`

## 🤝 Contributing

Expand Down
4 changes: 2 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ inputs:
required: true

outputs:
rqc_answer:
rqc_result:
description: "Remote Quick Command answer"
value: ${{ steps.rqc.outputs.answer }}
value: ${{ steps.rqc.outputs.result }}

runs:
using: "composite"
Expand Down
17 changes: 5 additions & 12 deletions rqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,16 @@ def get_execution_status(execution_id, access_token):
execution_id = create_rqc_execution(QC_SLUG, access_token, INPUT_DATA)
execution_status = get_execution_status(execution_id, access_token)

print(f'Execution Status: {execution_status}')

# Extract the 'answer' field from the step_result
answer_str = execution_status['steps'][0]['step_result']['answer']

result = execution_status['result']

print(f'Result: {result}')

# Remove the leading and trailing ```json and ``` for correct JSON parsing
if answer_str.startswith("```json"):
answer_str = answer_str[7:-4].strip()
if result.startswith("```json"):
result = result[7:-4].strip()

answer_data = json.loads(answer_str)
result_data = json.loads(result)

print(f'\n\033[36mRemote quick command answer:\033[0m \n\n{answer_data}')
print(f'\n\033[36mRemote quick command answer:\033[0m \n\n{result_data}')

save_output('answer', answer_data)
save_output('result', result_data)

print('\n\033[36mOutput saved successfully!\033[0m')

0 comments on commit 37eb64f

Please sign in to comment.