From d3fb4b87fd9d118f1325d2fccb859a3172c11b20 Mon Sep 17 00:00:00 2001 From: Maximilian Franzke <787658+mfranzke@users.noreply.github.com> Date: Wed, 11 Dec 2024 06:29:25 +0100 Subject: [PATCH] Create 99-add-issue-to-project.yml --- .github/workflows/99-add-issue-to-project.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/99-add-issue-to-project.yml diff --git a/.github/workflows/99-add-issue-to-project.yml b/.github/workflows/99-add-issue-to-project.yml new file mode 100644 index 0000000..1598e31 --- /dev/null +++ b/.github/workflows/99-add-issue-to-project.yml @@ -0,0 +1,27 @@ +name: Add Issue to Project + +on: + issues: + types: [opened] + +jobs: + add_to_project: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Add issue to GitHub Project + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Define GitHub Project ID and retrieve issue number + PROJECT_ID="8" + ISSUE_NUMBER="${{ github.event.issue.number }}" + + # GitHub API-call to add the issue to your project + curl -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github.inertia-preview+json" \ + -d "{\"content_type\": \"Issue\", \"content_id\": $ISSUE_NUMBER}" \ + "https://api.github.com/projects/columns/cards?project_id=$PROJECT_ID"