diff --git a/action.yml b/action.yml index 417cea0..595ae52 100644 --- a/action.yml +++ b/action.yml @@ -282,12 +282,13 @@ runs: PROJECT: ${{ inputs.project }} TOPICS: ${{ inputs.topics }} run: | + # Replace all topics, so topics that are not in the input are removed. args=() IFS=',' read -ra topics <<< "$TOPICS" for topic in "${topics[@]}"; do - args+=(--add-topic "$topic") + args+=(-f "names[]=$topic") done - gh repo edit "$PROJECT" "${args[@]}" + gh api -X PUT "repos/$PROJECT/topics" "${args[@]}" --silent - name: protect main branch shell: bash diff --git a/docs/inputs.md b/docs/inputs.md index 1f3bdc4..6e685d8 100644 --- a/docs/inputs.md +++ b/docs/inputs.md @@ -25,4 +25,4 @@ The inputs of the action, as used in the | settings_protect_main_branch_required_approving_review_count | The number of approvals that is required before a PR can be merged | | settings_projects | Whether the project tab should be enabled | | settings_wiki | Wiki enabled or not | -| topics | The topic(s) that will appear in the about menu of a project | +| topics | Comma-separated topics of a project. Replaces all topics: topics that are not listed are removed |