Skip to content

GHA Failure Log Analyzer #248

GHA Failure Log Analyzer

GHA Failure Log Analyzer #248

---
name: GHA Failure Log Analyzer
on:
workflow_dispatch:
inputs:
run_url:
description: GitHub Actions run URL to analyze
required: true
type: string
slack_channel_id:
description: Slack channel ID to post the analysis result
required: false
type: string
default: C07E4FF6YMB
slack_thread_ts:
description: Slack thread ts to post the analysis result
required: false
type: string
jobs:
analyze-logs:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
models: read
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Generate token for GitHub
id: generate-github-token
uses: camunda/infra-global-github-actions/generate-github-app-token-from-vault-secrets@ddce99387a10a4d578e4d7d8e6c6626dcd3d8fd3 # main
with:
github-app-id-vault-key: GITHUB_APP_ID
github-app-id-vault-path: secret/data/products/infrastructure-experience/ci/common
github-app-private-key-vault-key: GITHUB_APP_PRIVATE_KEY
github-app-private-key-vault-path: secret/data/products/infrastructure-experience/ci/common
vault-auth-method: approle
vault-auth-role-id: ${{ secrets.vault_role_id }}
vault-auth-secret-id: ${{ secrets.vault_secret_id }}
vault-url: ${{ secrets.vault_addr }}
- name: Import Secrets
id: secrets
uses: hashicorp/vault-action@4c06c5ccf5c0761b6029f56cfb1dcf5565918a3b # v3
with:
url: ${{ secrets.vault_addr }}
method: approle
roleId: ${{ secrets.vault_role_id }}
secretId: ${{ secrets.vault_secret_id }}
exportEnv: false
secrets: |
secret/data/products/infrastructure-experience/ci/common SLACK_BOT_TOKEN;
- name: GHA Failure Log Analyzer
id: analyze-logs
uses: ./.github/actions/gha-failure-log-analyzer
with:
run_url: ${{ github.event.inputs.run_url }}
slack_thread_ts: ${{ github.event.inputs.slack_thread_ts }}
slack_channel_id: ${{ github.event.inputs.slack_channel_id }}
remote_gh_access: ${{ steps.generate-github-token.outputs.token }}
gh_token: ${{ secrets.GITHUB_TOKEN}}
slack_token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
- name: Set Results as step output
id: set-output
continue-on-error: true # may fail depending on the response output size
run: echo "${{ steps.analyze-logs.outputs.response }}" >> "$GITHUB_STEP_SUMMARY"