Skip to content

Commit

Permalink
fix: gh cli -> gh api
Browse files Browse the repository at this point in the history
  • Loading branch information
flukolo4ek committed Oct 17, 2024
1 parent ddcbac6 commit d751fd0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LABELS: |
bug
duplicate
type/fix
type/feat
component/embeds
Expand Down Expand Up @@ -55,6 +56,7 @@ jobs:
bug
component/auth
component/docs
duplicate
type/fix
- name: Delete all labels
Expand Down
12 changes: 1 addition & 11 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,14 @@ runs:

- name: Add labels
shell: bash
run: ${{ github.action_path }}/src/labels/add_multiple.sh
run: ${{ github.action_path }}/src/labels/set.sh
if: ${{ steps.construct_labels.outputs.labels_to_add != '' }}
env:
LABELS: ${{ steps.construct_labels.outputs.labels_to_add }}
REPO: ${{ inputs.github_owner }}/${{ inputs.github_repo }}
PR_NUMBER: ${{ inputs.github_pr_number }}
GH_TOKEN: ${{ inputs.github_token }}

- name: Delete labels
shell: bash
run: ${{ github.action_path }}/src/labels/delete_multiple.sh
if: ${{ steps.construct_labels.outputs.labels_to_delete != '' }}
env:
LABELS: ${{ steps.construct_labels.outputs.labels_to_delete }}
PR_NUMBER: ${{ inputs.github_pr_number }}
REPO: ${{ inputs.github_owner }}/${{ inputs.github_repo }}
GH_TOKEN: ${{ inputs.github_token }}

branding:
icon: "tag"
color: "gray-dark"
5 changes: 3 additions & 2 deletions src/construct_labels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

CURRENT_LABELS="${CURRENT_LABELS:-""}"
OTHER_LABELS=""
PR_TITLE=${PR_TITLE}

CONFIG_JSON="https://raw.githubusercontent.com/datalens-tech/datalens/main/.github/workflows/scripts/changelog/changelog_config.json"
Expand All @@ -15,6 +16,7 @@ TYPE_LABELS_PREFIX=$(echo "$CONFIG_DATA" | jq -r '.section_tags.prefix')
COMPONENT_LABELS_PREFIX=$(echo "$CONFIG_DATA" | jq -r '.component_tags.prefix')

if [[ -n $CURRENT_LABELS ]]; then
OTHER_LABELS=$(echo "$CURRENT_LABELS" | grep -Ev "$TYPE_LABELS_PREFIX|$COMPONENT_LABELS_PREFIX" | sort)
CURRENT_LABELS=$(echo "$CURRENT_LABELS" | grep -E "$TYPE_LABELS_PREFIX|$COMPONENT_LABELS_PREFIX" | sort)
fi

Expand All @@ -29,8 +31,7 @@ if [[ -n $COMPONENT_SECTION ]]; then
LABELS_TO_ADD+="\n$COMMIT_COMPONENTS"
fi

LABELS_TO_ADD+="\n$OTHER_LABELS"
LABELS_TO_ADD=$(echo -e "$LABELS_TO_ADD" | sort)
LABELS_TO_DELETE=$(comm -13 <(echo "$LABELS_TO_ADD") <(echo "$CURRENT_LABELS"))

set_output "labels_to_add" "$LABELS_TO_ADD"
set_output "labels_to_delete" "$LABELS_TO_DELETE"
11 changes: 0 additions & 11 deletions src/labels/add_multiple.sh

This file was deleted.

11 changes: 0 additions & 11 deletions src/labels/delete_multiple.sh

This file was deleted.

0 comments on commit d751fd0

Please sign in to comment.