fix: LSDV-5486: Double encoding issue with file proxy urls #4510
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "PR labeler" | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
- ready_for_review | |
branches: | |
- master | |
- develop | |
- 'release/**' | |
- 'lse-release/**' | |
- 'ls-release/**' | |
env: | |
ACTIONS_STEP_DEBUG: '${{ secrets.ACTIONS_STEP_DEBUG }}' | |
jobs: | |
autolabel: | |
name: "PR label validator" | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: hmarr/debug-action@v2.1.0 | |
- name: "Validate PR's title" | |
uses: thehanimo/pr-title-checker@v1.4.0 | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
pass_on_octokit_error: false | |
configuration_path: ".github/pr-title-checker-config.json" | |
- name: "Set PR's label based on title" | |
uses: release-drafter/release-drafter@v5.23.0 | |
with: | |
disable-releaser: true | |
config-name: autolabeler.yml | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
release_field: | |
name: "Set Aha! Releases field" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hmarr/debug-action@v2.1.0 | |
- name: Set field | |
shell: bash | |
env: | |
COMMIT_MESSAGE: ${{ github.event.pull_request.title }} | |
AHA_SERVER: "https://labelstudio.aha.io" | |
AHA_TOKEN: "${{ secrets.AHA_TOKEN }}" | |
AHA_RELEASES_FIELD: releases | |
TAGS: '["oss"]' | |
run: | | |
set -euo pipefail ${ACTIONS_STEP_DEBUG:+-x} | |
regex="([a-zA-Z]+):[[:space:]]*([a-zA-Z0-9-]+)?:" | |
if [[ $COMMIT_MESSAGE =~ $regex ]]; then | |
export TICKET="${BASH_REMATCH[2]}" | |
if curl -fsSL \ | |
--request GET \ | |
--url "${AHA_SERVER}/api/v1/features/${TICKET}" \ | |
--header "Authorization: Bearer ${AHA_TOKEN}" \ | |
--header 'Accept: application/json'; then | |
cur_tags=$(curl -sSL \ | |
--request GET \ | |
--url "${AHA_SERVER}/api/v1/features/${TICKET}" \ | |
--header "Authorization: Bearer ${AHA_TOKEN}" \ | |
--header "Content-Type: application/json" \ | |
--header 'Accept: application/json' | | |
jq -ecr '[ .feature.custom_fields[] | select(.key=="releases") | .value ]') | |
echo "Current tags: ${cur_tags}" | |
new_tags=$(jq -ecr ". += ${TAGS} | flatten | unique" <<< $cur_tags) | |
echo "New tags: ${new_tags}" | |
curl -sSL \ | |
--request PUT \ | |
--url "${AHA_SERVER}/api/v1/features/${TICKET}" \ | |
--data "{\"feature\":{\"custom_fields\":{\"releases\":${new_tags}}}}" \ | |
--header "Authorization: Bearer ${AHA_TOKEN}" \ | |
--header "Content-Type: application/json" \ | |
--header 'Accept: application/json' | |
elif curl -fsSL \ | |
--request GET \ | |
--url "${AHA_SERVER}/api/v1/requirements/${TICKET}" \ | |
--header "Authorization: Bearer ${AHA_TOKEN}" \ | |
--header 'Accept: application/json'; then | |
cur_tags=$(curl -sSL \ | |
--request GET \ | |
--url "${AHA_SERVER}/api/v1/requirements/${TICKET}" \ | |
--header "Authorization: Bearer ${AHA_TOKEN}" \ | |
--header "Content-Type: application/json" \ | |
--header 'Accept: application/json' | | |
jq -ecr '[ .requirement.custom_fields[] | select(.key=="releases") | .value ]') | |
echo "Current tags: ${cur_tags}" | |
new_tags=$(jq -ecr ". += ${TAGS} | flatten | unique" <<< $cur_tags) | |
echo "New tags: ${new_tags}" | |
curl -sSL \ | |
--request PUT \ | |
--url "${AHA_SERVER}/api/v1/requirements/${TICKET}" \ | |
--data "{\"requirement\":{\"custom_fields\":{\"releases\":${new_tags}}}}" \ | |
--header "Authorization: Bearer ${AHA_TOKEN}" \ | |
--header "Content-Type: application/json" \ | |
--header 'Accept: application/json' | |
fi | |
fi |