Skip to content

Commit deb4c48

Browse files
authored
ROX-12735: add automation to enter new community PRs to OSS Triage board automatically (#946)
1 parent 0f6d6d1 commit deb4c48

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Add any new Pull Request to OSS Triaging project
2+
on:
3+
pull_request_target:
4+
types: [opened, reopened]
5+
6+
env:
7+
EXTERNAL_PR_LABEL: external-contributor
8+
PROJECT_URL: https://github.com/orgs/stackrox/projects/2 # OSS Triaging board
9+
10+
jobs:
11+
check-pr-if-external:
12+
name: Add external label to pull request if outside StackRox
13+
runs-on: ubuntu-latest
14+
env:
15+
GH_TOKEN: ${{ github.token }}
16+
BASE_REPO: ${{ github.repository }}
17+
HEAD_REPO: ${{ github.event.pull_request.head.user.login }}/${{ github.event.pull_request.head.repo.name }}
18+
outputs:
19+
is_external_pr: ${{ steps.check-external-pr.outputs.is_external_pr }}
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v3
23+
- id: check-external-pr
24+
run: |
25+
set -uo pipefail
26+
if [[ $BASE_REPO != $HEAD_REPO ]]; then
27+
echo "::set-output name=is_external_pr::true"
28+
gh pr edit \
29+
${{ github.event.pull_request.number }} \
30+
--add-label ${EXTERNAL_PR_LABEL}
31+
else
32+
echo "::set-output name=is_external_pr::false"
33+
fi
34+
35+
add-to-project:
36+
name: Add pull request to project
37+
runs-on: ubuntu-latest
38+
needs: [check-pr-if-external]
39+
if: needs.check-pr-if-external.outputs.is_external_pr == 'true'
40+
steps:
41+
- uses: actions/add-to-project@v0.3.0
42+
with:
43+
project-url: ${{ env.PROJECT_URL }}
44+
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}

0 commit comments

Comments
 (0)