Skip to content

Commit

Permalink
ci: Add workflow for manual XTS failed tests log collection (#16662)
Browse files Browse the repository at this point in the history
Signed-off-by: Mihail Mihov <[email protected]>
Co-authored-by: Roger Barker <[email protected]>
  • Loading branch information
mishomihov00 and rbarkerSL authored Nov 26, 2024
1 parent 935fdb1 commit df149d7
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/zxf-collect-workflow-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##

name: "ZXF: Collect Workflow Run Logs"
on:
workflow_dispatch:
inputs:
workflow_id:
description: "ID of the workflow run to collect logs from (example: #123456789)"
required: true

defaults:
run:
shell: bash

jobs:
collect-logs:
name: Collect Workflow Run Logs
runs-on: network-node-linux-medium
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Get run ID from run number
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
id: run_id
run: |
RUN_ID=$(gh api -H "Accept: application/vnd.github+json" \
/repos/hashgraph/hedera-services/actions/workflows/zxcron-extended-test-suite.yaml/runs \
--jq '.workflow_runs[] | select(.run_number == ${{ inputs.workflow_id }}) | .id')
echo "::set-output name=value::$RUN_ID"
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
ref: develop
token: ${{ secrets.GH_ACCESS_TOKEN }}

- name: Get run logs
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: gh run view ${{ steps.run_id.outputs.value }} --log >> workflow-run.log

- name: Upload log as artifact
id: upload-log
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
path: workflow-run.log

- name: Share log information
run: |
echo "### Logs Collected for Workflow:" >> $GITHUB_STEP_SUMMARY
echo "Workflow run ID: ${{ inputs.workflow_id }}" >> $GITHUB_STEP_SUMMARY
echo "Workflow URL: https://github.com/hashgraph/hedera-services/actions/runs/${{ steps.run_id.outputs.value }}" >> $GITHUB_STEP_SUMMARY
echo "Log file download URL: ${{ steps.upload-log.outputs.artifact-url }}" >> $GITHUB_STEP_SUMMARY

0 comments on commit df149d7

Please sign in to comment.