Skip to content

feat: assign issue or PR to project on setting milestone #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/99-assign-to-project-on-milestone-set.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Assign to Project on Milestone Set

on:
issues:
types: [milestoned]
pull_request:
types: [milestoned]

jobs:
assign_to_project:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Assign issue or PR to project if milestone set
run: |
# Set variables
ISSUE_OR_PR=${{ github.event.issue || github.event.pull_request }}

# Directly set the project ID here
PROJECT_ID="18"

# Get the repository details
REPO_NAME=${{ github.repository }}

# If project ID exists, assign the issue or PR to the project
if [ -n "$PROJECT_ID" ]; then
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{\"project_url\": \"https://api.github.com/repos/$REPO_NAME/projects/$PROJECT_ID\", \"content_id\": \"$ISSUE_OR_PR\", \"content_type\": \"issue\"}" \
"https://api.github.com/repos/$REPO_NAME/projects/$PROJECT_ID/columns/cards"
else
echo "Project ID not found!"
fi
Loading