-
Notifications
You must be signed in to change notification settings - Fork 382
32 lines (29 loc) · 1.44 KB
/
add_opened_pr_to_project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: 'Create Project Card for a New PR'
on:
pull_request_target:
# So we need this action purely to add PRs to a project. Once in the project,
# there are built-in project workflows for assigning new items to a column, and
# moving closing and reopening items within a project. I think we just need to handle
# the opened event, and we'll be good to go.
types: [ opened ]
env:
# this token must have typical repo write access plus full :project access
# Create this token with the correct permissions and add it as a repo secret
# It would be preferable to just use the GITHUB_TOKEN that Actions generates for a run,
# but I can't get the right projects (v2) write access to make it work. Eventually
# just use that, set permissions here, and delete the token.
GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
jobs:
create-card:
runs-on: ubuntu-latest
steps:
# check out the repo to get the script downloaded
- uses: actions/checkout@v4
# gets the current PR and stores it in a variable
- uses: jwalton/gh-find-current-pr@v1
id: findPr
# adds the variable to the environment so that we can use it in the next step
- run: echo "PR=${{ steps.findPr.outputs.pr }}" >> $GITHUB_ENV
# interact with the GitHub API and manipulate the Project
# we should also probably pass the project id as an env variable / argument
- run: bash scripts/dev/add_to_project.sh ${{ env.PR }}