Skip to content
Merged
10 changes: 0 additions & 10 deletions .github/aw/actions-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
"repo": "actions/github-script",
"version": "v9.0.0",
"sha": "3a2844b7e9c422d3c10d287c895573f7108da1b3"
},
"github/gh-aw-actions/setup-cli@v0.72.1": {
"repo": "github/gh-aw-actions/setup-cli",
"version": "v0.72.1",
"sha": "bc56a0cad2f450c562810785ef38649c04db812a"
},
"github/gh-aw-actions/setup@v0.72.1": {
"repo": "github/gh-aw-actions/setup",
"version": "v0.72.1",
"sha": "bc56a0cad2f450c562810785ef38649c04db812a"
}
}
}
29 changes: 23 additions & 6 deletions .github/scripts/fetch-launch-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ graphql() {

echo "::group::Fetching project metadata" >&2

PROJECT_META=$(graphql '
USER_PROJECT_META=$(graphql '
query($owner: String!, $number: Int!) {
user(login: $owner) {
projectV2(number: $number) {
Expand Down Expand Up @@ -96,12 +96,13 @@ query($owner: String!, $number: Int!) {
}
}
}
}' -F owner="$OWNER" -F number="$PROJECT_NUMBER" 2>/dev/null)
}' -F owner="$OWNER" -F number="$PROJECT_NUMBER" 2>/dev/null || true)

PROJECT_ID=$(echo "$PROJECT_META" | jq -r '.data.user.projectV2.id // empty')
PROJECT_META="$USER_PROJECT_META"
PROJECT_ID=$(echo "$USER_PROJECT_META" | jq -r '.data.user.projectV2.id // empty' 2>/dev/null || true)
if [ -z "$PROJECT_ID" ]; then
# Try as org owner
PROJECT_META=$(graphql '
ORG_PROJECT_META=$(graphql '
query($owner: String!, $number: Int!) {
organization(login: $owner) {
projectV2(number: $number) {
Expand Down Expand Up @@ -129,12 +130,28 @@ if [ -z "$PROJECT_ID" ]; then
}
}
}
}' -F owner="$OWNER" -F number="$PROJECT_NUMBER" 2>/dev/null)
PROJECT_ID=$(echo "$PROJECT_META" | jq -r '.data.organization.projectV2.id // empty')
}' -F owner="$OWNER" -F number="$PROJECT_NUMBER" 2>/dev/null || true)
PROJECT_META="$ORG_PROJECT_META"
PROJECT_ID=$(echo "$ORG_PROJECT_META" | jq -r '.data.organization.projectV2.id // empty' 2>/dev/null || true)
fi

if [ -z "$PROJECT_ID" ]; then
echo "Error: Could not find project $PROJECT_NUMBER for owner $OWNER" >&2
print_graphql_errors() {
local label="$1"
local response="$2"
local errors
errors=$(echo "$response" | jq -r '.errors[]?.message' 2>/dev/null | awk '!seen[$0]++' || true)
if [ -n "$errors" ]; then
echo "$label GraphQL errors:" >&2
echo "$errors" | sed 's/^/ - /' >&2
fi
}
print_graphql_errors "User project lookup" "$USER_PROJECT_META"
print_graphql_errors "Organization project lookup" "${ORG_PROJECT_META:-{}}"
echo "Check that AW_TOKEN can read this project and has the GitHub Projects scope." >&2
echo "For local testing, run: gh auth refresh -s read:project,project" >&2
echo "For Actions, update the AW_TOKEN repository secret with a PAT that can access the project." >&2
exit 1
fi

Expand Down
Loading