Skip to content

Commit fd75521

Browse files
fix: rename label handling outputs (#158)
* fix: rename step outputs * ci: bump actionlint * chore: fix pre-commit
1 parent c337191 commit fd75521

File tree

3 files changed

+45
-17
lines changed

3 files changed

+45
-17
lines changed

.github/workflows/build-test-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
python-version: "3.7"
3636
- name: Install actionlint
3737
run: |
38-
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.6.22/scripts/download-actionlint.bash)
38+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.6.24/scripts/download-actionlint.bash)
3939
- uses: pre-commit/[email protected]
4040

4141
publish:

.github/workflows/reusable-build-test-release.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ jobs:
6565
execute-modinput_functional: ${{ steps.delay-destroy-setup.outputs.execute-modinput_functional }}
6666
execute-scripted_inputs: ${{ steps.delay-destroy-setup.outputs.execute-scripted_inputs }}
6767
execute-requirement_test: ${{ steps.delay-destroy-setup.outputs.execute-requirement_test }}
68-
execute-labeled-knowledge: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-knowledge }}
69-
execute-labeled-ui: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-ui }}
70-
execute-labeled-escu: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-escu }}
71-
execute-labeled-modinput: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-modinput_functional }}
72-
execute-labeled-scripted_inputs: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-scripted_inputs }}
73-
execute-labeled-requirement: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-requirement_test }}
68+
execute-labeled-knowledge: ${{ steps.configure-tests-on-labels.outputs.execute_knowledge_labeled }}
69+
execute-labeled-ui: ${{ steps.configure-tests-on-labels.outputs.execute_ui_labeled }}
70+
execute-labeled-escu: ${{ steps.configure-tests-on-labels.outputs.execute_escu_labeled }}
71+
execute-labeled-modinput: ${{ steps.configure-tests-on-labels.outputs.execute_modinput_functional_labeled }}
72+
execute-labeled-scripted_inputs: ${{ steps.configure-tests-on-labels.outputs.execute_scripted_inputs_labeled }}
73+
execute-labeled-requirement: ${{ steps.configure-tests-on-labels.outputs.execute_requirement_test_labeled }}
7474
steps:
7575
- name: skip workflow if description is empty for labeled pr
7676
id: skip-workflow
@@ -104,8 +104,8 @@ jobs:
104104
set +e
105105
TESTSET="${{ steps.skip-workflow.outputs.testset }}"
106106
for test_type in $TESTSET; do
107-
eval DELAY_DESTROY_"$test_type"="No"
108-
eval EXECUTE_"$test_type"="No"
107+
eval DELAY_DESTROY_$test_type="No"
108+
eval EXECUTE_$test_type="No"
109109
done
110110
if [[ '${{ github.event.label.name }}' == 'preserve_infra' ]]; then
111111
echo "$PR_BODY" >> body.txt
@@ -115,8 +115,8 @@ jobs:
115115
fi
116116
for test_type in $TESTSET; do
117117
if [[ $tests =~ $test_type ]]; then
118-
eval EXECUTE_"$test_type"="Yes"
119-
eval DELAY_DESTROY_"$test_type"="Yes"
118+
eval EXECUTE_$test_type="Yes"
119+
eval DELAY_DESTROY_$test_type="Yes"
120120
fi
121121
done
122122
fi
@@ -180,8 +180,8 @@ jobs:
180180
181181
echo "Tests to execute based on labels:"
182182
for test_type in "${TESTSET[@]}"; do
183-
echo "execute-labeled-$test_type=${EXECUTE_LABELED["$test_type"]}" >> "$GITHUB_OUTPUT"
184-
echo "execute-labeled-$test_type: ${EXECUTE_LABELED["$test_type"]}"
183+
echo "$test_type""_labeled=${EXECUTE_LABELED["$test_type"]}" >> "$GITHUB_OUTPUT"
184+
echo "$test_type""_labeled: ${EXECUTE_LABELED["$test_type"]}"
185185
done
186186
meta:
187187
runs-on: ubuntu-latest
@@ -1015,7 +1015,7 @@ jobs:
10151015
id: get-argo-token
10161016
run: |
10171017
ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id ta-github-workflow-automation-token | jq -r '.SecretString')
1018-
echo "::set-output name=argo-token::$ARGO_TOKEN"
1018+
echo "argo-token=$ARGO_TOKEN" >> "$GITHUB_OUTPUT"
10191019
- name: create job name
10201020
id: create-job-name
10211021
shell: bash
@@ -1025,7 +1025,7 @@ jobs:
10251025
JOB_NAME=${JOB_NAME//TEST-TYPE/${{ env.TEST_TYPE }}}
10261026
JOB_NAME=${JOB_NAME//[_.]/-}
10271027
JOB_NAME=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')
1028-
echo "::set-output name=job-name::$JOB_NAME"
1028+
echo "job-name=$JOB_NAME" >> "$GITHUB_OUTPUT"
10291029
- name: Splunk instance details
10301030
id: splunk-instance-details
10311031
if: ${{ needs.setup-workflow.outputs.delay-destroy-requirement_test == 'Yes' }}
@@ -1064,7 +1064,7 @@ jobs:
10641064
run: |
10651065
set -o xtrace
10661066
if argo watch ${{ steps.run-tests.outputs.workflow-name }} -n workflows | grep "pod deleted"; then
1067-
echo "::set-output name=retry-workflow::true"
1067+
echo "retry-workflow=true" >> "$GITHUB_OUTPUT"
10681068
fi
10691069
- name: Retrying workflow
10701070
id: retry-wf
@@ -1078,7 +1078,7 @@ jobs:
10781078
if [[ "${{ steps.is-pod-deleted.outputs.retry-workflow }}" == "true" ]]
10791079
then
10801080
WORKFLOW_NAME=$(argo resubmit -v -o json -n workflows "${{ steps.run-tests.outputs.workflow-name }}" | jq -r .metadata.name)
1081-
echo "::set-output name=workflow-name::$$WORKFLOW_NAME"
1081+
echo "workflow-name=$WORKFLOW_NAME" >> "$GITHUB_OUTPUT"
10821082
argo logs --follow "${WORKFLOW_NAME}" -n workflows || echo "... there was an error fetching logs, the workflow is still in progress. please wait for the workflow to complete ..."
10831083
else
10841084
echo "No retry required"

.github/workflows/test.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# GitHub repository details
4+
OWNER="your_username"
5+
REPO="your_repository"
6+
7+
# GitHub API endpoint for labels
8+
API_URL="https://api.github.com/repos/$OWNER/$REPO/labels"
9+
10+
# GitHub personal access token (replace with your own)
11+
TOKEN="your_personal_access_token"
12+
13+
14+
# Array of label details
15+
LABELS=(
16+
'{"name": "execute_knowledge", "description": "Trigger execution of knowledge objects tests", "color": "4040F2"}'
17+
'{"name": "execute_ui", "description": "Trigger execution of ui tests", "color": "F79D34"}'
18+
'{"name": "execute_modinput_functional", "description": "Trigger execution of modinput functional tests", "color": "7ED321"}'
19+
'{"name": "execute_scripted_inputs", "description": "Trigger execution of scripted inputs tests", "color": "9013FE"}'
20+
'{"name": "execute_escu", "description": "Trigger execution of escu tests", "color": "F5A623"}'
21+
'{"name": "execute_requirement_test", "description": "Trigger execution of requirement tests", "color": "F8E71C"}'
22+
'{"name": "execute_all_tests", "description": "Trigger execution of all tests types", "color": "006B76"}'
23+
)
24+
25+
# Loop through the labels and add them to the repository
26+
for label in "${LABELS[@]}"; do
27+
gh label create "$(echo "$label" | jq -r '.| .name')" --color "$(echo "$label" | jq -r '.| .color')" --description "$(echo "$label" | jq '.| .description')" --force
28+
done

0 commit comments

Comments
 (0)