File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 3535 is_valid_branch : ${{ steps.check.outputs.is_valid_branch }}
3636 steps :
3737 - name : Check for label and branch prefix
38+ env :
39+ LABELS_JSON : ${{ inputs.labels }}
3840 id : check
3941 run : |
4042 TARGET_LABEL="${{ inputs.target_label }}"
4446 echo "Checking for label: $TARGET_LABEL"
4547 echo "Required branch prefix: $BRANCH_PREFIX"
4648 echo "Current branch: $CURRENT_BRANCH"
47- echo "Input labels: ${{ inputs.labels }} "
49+ echo "Input labels: $LABELS_JSON "
4850
4951 # Check if branch has the required prefix
5052 if [ -n "$BRANCH_PREFIX" ]; then
6163 fi
6264
6365 # Use jq to check if the label exists in the labels array
64- HAS_LABEL=$(echo '${{ inputs.labels }}' | \
66+ HAS_LABEL=$(echo "$LABELS_JSON" | \
6567 jq --arg target "$TARGET_LABEL" \
6668 '[.[] | select(.name == $target)] | length > 0')
6769
9294 - name : Display Validation Result
9395 run : |
9496 echo "Validation result: ${{ steps.check.outputs.is_valid }}"
97+ echo "Has label: ${{ steps.check.outputs.has_label }}"
98+ echo "Is valid branch: ${{ steps.check.outputs.is_valid_branch }}"
Original file line number Diff line number Diff line change @@ -28,11 +28,16 @@ jobs:
2828 steps :
2929 - name : Filter labels by prefix
3030 id : filter
31+ env :
32+ LABELS_JSON : ${{ inputs.labels }}
3133 run : |
3234 PREFIX="${{ inputs.prefix }}"
3335
36+ echo "Prefix: $PREFIX"
37+ echo "Input labels: $LABELS_JSON"
38+
3439 # Use jq to filter labels by prefix (empty prefix returns all labels)
35- JSON_RESULT=$(echo '${{ inputs.labels }}' | \
40+ JSON_RESULT=$(echo "$LABELS_JSON" | \
3641 jq --arg prefix "$PREFIX" \
3742 'map(select(.name | startswith($prefix))) |
3843 map({(.name): .}) |
4954 echo "$JSON_RESULT"
5055 echo "EOF"
5156 } >> $GITHUB_OUTPUT
52- echo "Labels result: $JSON_RESULT"
57+
58+ - name : Display Filter Result
59+ run : |
60+ echo "Filtered labels: ${{ steps.filter.outputs.filtered-labels }}"
You can’t perform that action at this time.
0 commit comments