forked from bitwarden/ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bitwarden:main' into main
- Loading branch information
Showing
1,660 changed files
with
22,052 additions
and
5,737 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: Dispatch Workflow and Download Artifacts | ||
description: 'Dispatches a workflow, waits for completion, and downloads artifacts' | ||
inputs: | ||
token: | ||
description: GitHub Personal Access Token for making API requests. | ||
required: true | ||
workflow: | ||
description: The workflow to dispatch, can be a filename or ID | ||
required: true | ||
ref: | ||
description: The branch or tag to dispatch the workflow on | ||
default: 'main' | ||
repo: | ||
description: Repository of the action to dispatch. | ||
default: ${{ github.repository }} | ||
owner: | ||
description: Owner of the given repository. | ||
default: ${{ github.repository_owner }} | ||
workflow_timeout_seconds: | ||
description: Time until giving up waiting for the start of the workflow run. | ||
default: 120 | ||
workflow_inputs: | ||
description: A flat JSON object, only supports strings, numbers, and booleans (as per workflow inputs API). | ||
distinct_id: | ||
description: Specify a static string to use instead of a random distinct ID. | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Log inputs to job summary | ||
shell: bash | ||
run: | | ||
echo "<details><summary>Dispatch and Download Action Workflow Inputs</summary>" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo '```json' >> $GITHUB_STEP_SUMMARY | ||
echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY | ||
echo '```' >> $GITHUB_STEP_SUMMARY | ||
echo "</details>" >> $GITHUB_STEP_SUMMARY | ||
- name: Dispatch an action and get the run ID and URL | ||
uses: codex-/return-dispatch@06d9405c91c1696f12c0bf915ab9c5161c8f06fc # v2.0.1 | ||
id: return_dispatch | ||
with: | ||
token: ${{ inputs.token }} | ||
ref: ${{ inputs.ref }} | ||
repo: ${{ inputs.repo }} | ||
owner: ${{ inputs.owner }} | ||
workflow: ${{ inputs.workflow }} | ||
workflow_timeout_seconds: ${{ inputs.workflow_timeout_seconds }} | ||
workflow_inputs: ${{ inputs.workflow_inputs }} | ||
distinct_id: ${{ inputs.distinct_id }} | ||
|
||
- name: Use the output run ID and URL | ||
shell: bash | ||
run: | | ||
echo ${{steps.return_dispatch.outputs.run_id}} | ||
echo ${{steps.return_dispatch.outputs.run_url}} | ||
- name: Wait for workflow to finish | ||
shell: bash | ||
run: | | ||
sleep 5 | ||
timeout="30" # in seconds | ||
interval="10" # in seconds | ||
counter=0 | ||
timeout_counter=0 | ||
url="https://api.github.com/repos/${{ inputs.owner }}/${{ inputs.repo }}/actions/runs/${{steps.return_dispatch.outputs.run_id}}" | ||
while true; do | ||
run_data=$(curl -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ inputs.token }}" $url) | ||
status=$(echo "$run_data" | jq -r '.status') | ||
echo "Try -> $timeout_counter; status -> $status" | ||
if [ "$status" = "completed" ]; then | ||
conclusion=$(echo "$run_data" | jq -r '.conclusion') | ||
if [ "$conclusion" != "success" ]; then | ||
echo "::error::Dispatched workflow failed." | ||
exit 1 | ||
else | ||
echo "::debug::Dispatched workflow completed successfully!" | ||
break | ||
fi | ||
fi | ||
timeout_counter=$((timeout_counter + 1)) | ||
if [ $((timeout_counter * interval)) -ge $((timeout * 60)) ]; then | ||
echo "::error::Timeout waiting for the Dispatched workflow to complete." | ||
exit 1 | ||
fi | ||
sleep $interval | ||
done | ||
- name: Download all artifacts | ||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | ||
id: download | ||
with: | ||
run-id: ${{steps.return_dispatch.outputs.run_id}} | ||
github-token: ${{ inputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.