|
1
|
name: Create Linear Issue on Pull Request |
|
2
|
|
|
3
|
on: |
|
4
|
pull_request: |
|
5
|
branches: |
|
6
|
- develop |
|
7
|
types: [opened] |
|
8
|
|
|
9
|
jobs: |
|
10
|
create-linear-issue-on-pull-request: |
|
11
|
runs-on: ubuntu-latest |
|
12
|
steps: |
|
13
|
- name: Check if PR Author is in Team |
|
14
|
id: check_author |
|
15
|
env: |
|
16
|
GITHUB_TOKEN: ${{ secrets.READ_ORG_PAT }} |
|
17
|
run: | |
|
18
|
response=$(curl -s -o /dev/null -w "%{http_code}" \ |
|
19
|
-H "Authorization: Bearer $GITHUB_TOKEN" \ |
|
20
|
https://api.github.com/orgs/medusajs/teams/engineering/memberships/${{ github.event.pull_request.user.login }}) |
|
21
|
if [[ "$response" -eq 200 ]]; then |
|
22
|
echo "author_is_team_member=true\n" >> $GITHUB_OUTPUT |
|
23
|
else |
|
24
|
echo "author_is_team_member=false\n" >> $GITHUB_OUTPUT |
|
25
|
fi |
|
26
|
- name: Create the Linear Issue |
|
27
|
if: ${{ steps.check_author.outputs.author_is_team_member == 'false' }} |
|
28
|
id: create_issue |
|
29
|
uses: ctriolo/action-create-linear-issue@v0.5 |
|
30
|
with: |
|
31
|
linear-api-key: ${{secrets.LINEAR_API_KEY}} |
|
32
|
linear-team-key: "SUP" |
|
33
|
linear-issue-title: ${{github.event.pull_request.title}} |
|
34
|
linear-issue-description: ${{github.event.pull_request.body}} |
|
35
|
linear-attachment-url: ${{github.event.pull_request.html_url}} |
|
36
|
linear-attachment-title: ${{github.event.pull_request.title}} |