trigger-event #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create New Project | |
on: | |
repository_dispatch: | |
types: ["trigger-event"] | |
env: | |
repo: ${{ github.repository }} | |
org: ${{ github.repository_owner }} | |
title: ${{ github.event.client_payload.title }} | |
GH_TOKEN: ${{ secrets.PROJECT_TOKEN }} | |
jobs: | |
create-project: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up GitHub CLI | |
uses: ksivamuthu/actions-setup-gh-cli@v3 | |
- name: Create GitHub project and issues | |
run: | | |
project=$(gh project create --owner "$org" --title "$title" --format json --jq .number) | |
# gh project link $project | |
# gh project link $project --owner "$org" --team "curation-and-recruitment" | |
for file in issue_template/*.md; do | |
issue_title="$title - $(basename ${file%.md} | tr '_' ' ' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')" | |
gh issue -R "$repo" create --title "$issue_title" --body-file "$file" --project "$title" | |
done |