Skip to content

Commit

Permalink
Fixes and improvements to transfer-issues.yml/sh: (#1752)
Browse files Browse the repository at this point in the history
- Remove static values from environment variables
- replace updateIssue with addLabeltoLabelable to preserve existing labels during transfer
  • Loading branch information
KevinMind authored Apr 23, 2024
1 parent 1bf3e46 commit 616db93
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/transfer-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ jobs:

- name: Transfer issues
env:
ALLOWED_REPOS: "addons-server,addons-frontend"
# Required inputs
GH_TOKEN: ${{ secrets[format('{0}', inputs.secret_name)] }}
FROM_NAME: ${{ inputs.from_name }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
TO_NAME: ${{ github.event.repository.name }}
# One or the other is required
COUNT: ${{ inputs.count }}
ISSUE_NUMBER: ${{ inputs.issue_number }}
shell: bash
Expand Down
12 changes: 6 additions & 6 deletions scripts/transfer-issues.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ set -u

# Required environment variables
# GITHUB_TOKEN: GitHub token with repo scope
# REPOSITORY_OWNER: GitHub repository owner
# FROM_NAME: Repository name to transfer issues from
# TO_NAME: Repository name to transfer issues to
# ALLOWED_REPOS: Comma-separated list of allowed repositories

# Optional environment variables
# ISSUE_NUMBER: Issue number to transfer (will nullify COUNT)
# COUNT: Number of issues to transfer

REPOSITORY_OWNER="mozilla"
TO_NAME="addons"
ALLOWED_REPOS="addons-server,addons-frontend"
FROM_REPO="$REPOSITORY_OWNER/$FROM_NAME"
TO_REPO="$REPOSITORY_OWNER/$TO_NAME"

echo """
REPOSITORY_OWNER: $REPOSITORY_OWNER
FROM_NAME: $FROM_NAME
REPOSITORY_OWNER: $REPOSITORY_OWNER
TO_NAME: $TO_NAME
ALLOWED_REPOS: $ALLOWED_REPOS
FROM_REPO: $FROM_REPO
TO_REPO: $TO_REPO
Expand Down Expand Up @@ -114,7 +114,7 @@ label_mutation="mutation {"
label_counter=1

while IFS= read -r id; do
label_mutation+=" l${label_counter}: updateIssue(input: {id: \"$id\", labelIds: [\"$label_id\"]}) { __typename }"
label_mutation+=" l${label_counter}: addLabelsToLabelable(input: {labelableId: \"$id\", labelIds: [\"$label_id\"]}) { __typename }"
label_counter=$((label_counter+1))
done <<< $(echo "$new_issues" | jq -r '.id')

Expand Down

0 comments on commit 616db93

Please sign in to comment.