-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
102 lines (96 loc) · 3.9 KB
/
Copy pathaction.yml
File metadata and controls
102 lines (96 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: 'Send GitHub Workflow Logs to Splunk'
description: 'Collects GitHub workflow logs and sends them to a Splunk HTTP Event Collector (HEC)'
inputs:
github_token:
description: 'GitHub personal access token with repo scope'
required: true
splunk_url:
description: 'URL of the Splunk HTTP Event Collector (HEC) including the port (e.g., https://splunk.example.com:8088)'
required: true
splunk_token:
description: 'HEC token for authentication'
required: true
run_id:
description: 'ID of the specific workflow run (defaults to current run)'
required: false
default: ${{ github.run_id }}
index:
description: 'Splunk index to send the logs to'
required: false
# An empty string defaults to the index associated with the HEC token.
default: ''
source_type:
description: 'Splunk source type for the data'
required: false
default: 'github:workflow:logs'
ssl_verify:
description: 'Whether to verify SSL certificates when connecting to Splunk'
required: false
default: 'true'
include_job_steps:
description: 'Whether to include individual job step logs'
required: false
default: 'true'
timeout:
description: 'HTTP request timeout in seconds'
required: false
default: '30'
max_retries:
description: 'Maximum number of retries for failed requests'
required: false
default: '3'
debug:
description: 'Enable debug mode to print the Splunk event payload instead of sending it to Splunk.'
required: false
default: 'false'
# -------------------------------------------------------------------------------------------------------------------- #
# Run the action using a Docker container #
# -------------------------------------------------------------------------------------------------------------------- #
runs:
using: 'docker'
image: 'docker://ghcr.io/ykoer/github-workflow-splunk-logger:v1'
args:
- "python"
- "/app/splunk_logger.py"
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
INPUT_SPLUNK_URL: ${{ inputs.splunk_url }}
INPUT_SPLUNK_TOKEN: ${{ inputs.splunk_token }}
INPUT_RUN_ID: ${{ inputs.run_id }}
INPUT_INDEX: ${{ inputs.index }}
INPUT_SOURCE_TYPE: ${{ inputs.source_type }}
INPUT_SSL_VERIFY: ${{ inputs.ssl_verify }}
INPUT_INCLUDE_JOB_STEPS: ${{ inputs.include_job_steps }}
INPUT_TIMEOUT: ${{ inputs.timeout }}
INPUT_MAX_RETRIES: ${{ inputs.max_retries }}
INPUT_DEBUG: ${{ inputs.debug }}
# -------------------------------------------------------------------------------------------------------------------- #
# Run the action using a composite action #
# -------------------------------------------------------------------------------------------------------------------- #
# runs:
# using: 'composite'
# steps:
# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: '3.12'
# - name: Install dependencies
# shell: bash
# run: |
# python -m pip install --upgrade pip
# pip install -r ${{ github.action_path }}/requirements.txt
# - name: Run script
# shell: bash
# run: python ${{ github.action_path }}/src/github_workflow_splunk_logger.py
# env:
# GITHUB_TOKEN: ${{ github.token }}
# INPUT_SPLUNK_URL: ${{ inputs.splunk_url }}
# INPUT_SPLUNK_TOKEN: ${{ inputs.splunk_token }}
# INPUT_RUN_ID: ${{ inputs.run_id }}
# INPUT_INDEX: ${{ inputs.index }}
# INPUT_SOURCE_TYPE: ${{ inputs.source_type }}
# INPUT_SSL_VERIFY: ${{ inputs.ssl_verify }}
# INPUT_INCLUDE_JOB_STEPS: ${{ inputs.include_job_steps }}
# INPUT_TIMEOUT: ${{ inputs.timeout }}
# INPUT_MAX_RETRIES: ${{ inputs.max_retries }}
# INPUT_DEBUG: ${{ inputs.debug }}