From f3f92d263a49b805dc183c59bfd70e91dffe62d3 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Wed, 11 Dec 2024 08:04:19 +0100 Subject: [PATCH] Update 99-add-issue-to-project.yml --- .github/workflows/99-add-issue-to-project.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/99-add-issue-to-project.yml b/.github/workflows/99-add-issue-to-project.yml index 34457f1..1441ad1 100644 --- a/.github/workflows/99-add-issue-to-project.yml +++ b/.github/workflows/99-add-issue-to-project.yml @@ -27,26 +27,22 @@ jobs: }' -q .data.repository.issue.id) echo "ISSUE_ID=$issue_id" >> $GITHUB_ENV - - name: Verify DEV_PROJECT_ID + - name: Verify access to organization project env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DEV_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }} ORG: ${{ github.repository_owner }} + DEV_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }} run: | result=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/orgs/$ORG/projects/$DEV_PROJECT_ID") + -H "Accept: application/vnd.github.inertia-preview+json" \ + "https://api.github.com/projects/$DEV_PROJECT_ID") echo "Project response: $result" if echo "$result" | jq -e . >/dev/null 2>&1; then - project_state=$(echo $result | jq -r '.state') - if [ "$project_state" != "open" ]; then - echo "Project is not open or not found" - exit 1 - fi + echo "Verified project exists." else - echo "Failed to parse project response as JSON." + echo "Failed to verify project existence." exit 1 fi @@ -55,7 +51,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DEV_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }} - ORG: ${{ github.repository_owner }} run: | columns=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.inertia-preview+json" \ @@ -81,7 +76,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | PROJECT_CARD_URL="https://api.github.com/projects/columns/$COLUMN_ID/cards" - + # Create a project card for the issue in the specified column curl -X POST -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "Accept: application/vnd.github.v3+json" \