Skip to content

Commit 84019ec

Browse files
authored
Update GH Action 'add-content-to-project' to use 'pull_request_target' to allow access to project secrets (#6)
1 parent 4767575 commit 84019ec

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Based on https://github.com/leonsteinhaeuser/project-beta-automations
2+
3+
name: "Add Issues/PRs to TF Provider DevEx team board"
4+
5+
on:
6+
issues:
7+
types: [opened, reopened]
8+
pull_request_target:
9+
# NOTE: The way content is added to project board is equivalent to an "upsert".
10+
# Calling it multiple times will be idempotent.
11+
#
12+
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
13+
# to see the reasoning behind using `pull_request_target` instead of `pull_request`
14+
types: [opened, reopened, ready_for_review]
15+
16+
jobs:
17+
add-content-to-project:
18+
name: "Add Content to project"
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: "Set Issue to 'Priority = Triage Next'"
22+
uses: leonsteinhaeuser/project-beta-automations@v1.2.1
23+
if: github.event_name == 'issues'
24+
with:
25+
gh_token: ${{ secrets.TF_DEVEX_PROJECT_GITHUB_TOKEN }}
26+
organization: "hashicorp"
27+
project_id: 99 #< https://github.com/orgs/hashicorp/projects/99
28+
resource_node_id: ${{ github.event.issue.node_id }}
29+
operation_mode: custom_field
30+
custom_field_values: '[{\"name\":\"Priority\",\"type\":\"single_select\",\"value\":\"Triage Next\"}]'
31+
- name: "Set Pull Request to 'Priority = Triage Next'"
32+
uses: leonsteinhaeuser/project-beta-automations@v1.2.1
33+
if: github.event_name == 'pull_request'
34+
with:
35+
gh_token: ${{ secrets.TF_DEVEX_PROJECT_GITHUB_TOKEN }}
36+
organization: "hashicorp"
37+
project_id: 99 #< https://github.com/orgs/hashicorp/projects/99
38+
resource_node_id: ${{ github.event.pull_request.node_id }}
39+
operation_mode: custom_field
40+
custom_field_values: '[{\"name\":\"Priority\",\"type\":\"single_select\",\"value\":\"Triage Next\"}]'

0 commit comments

Comments
 (0)