Skip to content

Commit

Permalink
Filter out inaccessible tasks from release (#3133)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1204006570077678/1208036161861761/f
Tech Design URL:
CC:

**Description**:
When a task is deleted or private, we will remove it from the release,
given that it will make it fail.

**Steps to test this PR**:
I tested this by using an internal release and adding an `exit 0` on
line `279` (to ensure the script doesn’t move forward). I added a delete
task to the release and tested the id that wasn’t part of the `task_ids`
array.

**Definition of Done**:

* [x] Does this PR satisfy our [Definition of
Done](https://app.asana.com/0/1202500774821704/1207634633537039/f)?

---
###### Internal references:
[Pull Request Review
Checklist](https://app.asana.com/0/1202500774821704/1203764234894239/f)
[Software Engineering
Expectations](https://app.asana.com/0/59792373528535/199064865822552)
[Technical Design
Template](https://app.asana.com/0/59792373528535/184709971311943)
[Pull Request
Documentation](https://app.asana.com/0/1202500774821704/1204012835277482/f)
  • Loading branch information
jotaemepereira authored Aug 22, 2024
1 parent fc4f67c commit bcb5078
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions scripts/update_asana_for_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ fetch_current_release_notes() {
get_task_id() {
local url="$1"
if [[ "$url" =~ ${task_url_regex} ]]; then
echo "${BASH_REMATCH[1]}"
local task_id="${BASH_REMATCH[1]}"
local http_code
http_code="$(curl -fLSs "${asana_api_url}/tasks/${task_id}?opt_fields=gid" \
-H "Authorization: Bearer ${ASANA_ACCESS_TOKEN}" \
--write-out '%{http_code}' \
--output /dev/null)"
if [[ "$http_code" -eq 200 ]]; then
echo "${task_id}"
else
echo ""
fi
fi
}

Expand Down Expand Up @@ -265,7 +275,11 @@ handle_internal_release() {

local task_ids=()
while read -r line; do
task_ids+=("$(get_task_id "$line")")
local task_id
task_id="$(get_task_id "$line")"
if [[ -n "$task_id" ]]; then
task_ids+=("$task_id")
fi
done <<< "$(find_task_urls_in_git_log "$last_release_tag")"

# 2. Fetch current release notes from Asana release task.
Expand Down Expand Up @@ -327,7 +341,11 @@ get_tasks_in_last_internal_release() {
# 2. Convert Asana task URLs from git commit messages to task IDs
local task_ids=()
while read -r line; do
task_ids+=("$(get_task_id "$line")")
local task_id
task_id="$(get_task_id "$line")"
if [[ -n "$task_id" ]]; then
task_ids+=("$task_id")
fi
done <<< "$(find_task_urls_in_git_log "$last_release_tag")"

# 3. Construct a HTML list of task IDs
Expand Down

0 comments on commit bcb5078

Please sign in to comment.