diff --git a/.gitea/workflows/tag-old-issues.yaml b/.gitea/workflows/tag-old-issues.yaml index 58d6d6c..7600ba0 100644 --- a/.gitea/workflows/tag-old-issues.yaml +++ b/.gitea/workflows/tag-old-issues.yaml @@ -17,8 +17,7 @@ jobs: env: BOT_TOKEN: ${{ secrets.BOT_TOKEN }} INSTANCE_URL: ${{ vars.INSTANCE_URL }} - REPO_OWNER: ${{ gitea.repository_owner }} - REPO_NAME: ${{ gitea.repository }} + REPOSITORY: ${{ gitea.repository }} TAG_NAME: 'stale' DAYS_OLD: 3 EXCLUDE_TAG_NAME: '' @@ -29,7 +28,7 @@ jobs: sudo apt-get -qq update && sudo apt-get -qq install -y jq curl # --- Conditionally build the API URL --- - API_URL="${INSTANCE_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/issues?state=open" + API_URL="${INSTANCE_URL}/api/v1/repos/${REPOSITORY}/issues?state=open" if [[ -n "${REQUIRED_TAG}" ]]; then echo ">> Filtering for issues with the required tag: ${REQUIRED_TAG}" # URL-encode the tag to handle special characters @@ -65,7 +64,7 @@ jobs: EXISTING_LABELS=$(curl -s -X GET \ -H "Authorization: token ${BOT_TOKEN}" \ -H "Accept: application/json" \ - "${INSTANCE_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/issues/${ISSUE_NUMBER}/labels" | jq -r '.[].name') + "${INSTANCE_URL}/api/v1/repos/${REPOSITORY}/issues/${ISSUE_NUMBER}/labels" | jq -r '.[].name') # Add the new tag to the list of existing labels NEW_LABELS=$(echo -e "${EXISTING_LABELS}\n${TAG_NAME}" | sort -u | jq -R -s -c 'split("\n") | map(select(length > 0))') @@ -76,7 +75,7 @@ jobs: -H "Authorization: token ${BOT_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"labels\": $(echo "$NEW_LABELS" | jq -r 'map(select(. != ""))')}" \ - "${INSTANCE_URL}/api/v1/repos/${REPO_OWNER}/${REPO_NAME}/issues/${ISSUE_NUMBER}/labels" + "${INSTANCE_URL}/api/v1/repos/${REPOSITORY}/issues/${ISSUE_NUMBER}/labels" else echo ">> Skipping issue #${ISSUE_NUMBER} because it has the '${EXCLUDE_TAG_NAME}' tag." fi