-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NEW Create GitHub Action for adding PRs to the new project
- Loading branch information
1 parent
b5d2af0
commit 684885a
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# GitHub Actions - Add PR to project | ||
|
||
Add community-created pull requests to the [Community Contributions project](https://github.com/orgs/silverstripe/projects/4) when they're opened. | ||
|
||
## Usage | ||
|
||
**.github/workflows/add-pr-to-project.yml** | ||
```yml | ||
name: Add pull request to project | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
add-pr-to-project: | ||
steps: | ||
- name: Add PR to project | ||
uses: silverstripe/add-pr-to-project@v1 | ||
``` | ||
This action has no inputs. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Add pull request to project | ||
description: GitHub Action to add new pull requests to the Community Contributions GitHub project | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
|
||
- name: Check if should be added | ||
id: check-if-should-add | ||
env: | ||
PR_AUTHOR: ${{ github.event.pull_request.user.login }} | ||
run: | | ||
# We don't want CMS Squad member PRs to clutter the project board | ||
echo "Author is $PR_AUTHOR" | ||
for squad_member in 'GuySartorelli' 'emteknetnz' 'maxime-rainville'; do | ||
if [[ $PR_AUTHOR == $squad_member ]]; then | ||
echo "Author is in CMS Squad. Skipping." | ||
echo "should_add_to_project=false" >> $GITHUB_OUTPUT | ||
exit 0 | ||
fi | ||
done | ||
echo "should_add_to_project=true" >> $GITHUB_OUTPUT | ||
- name: Generate token | ||
id: generate-token | ||
if: steps.check-if-should-add.outputs.should_add_to_project == 'true' && github.repository_owner == 'silverstripe' | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ vars.PROJECT_MANAGER_APP_ID }} | ||
private-key: ${{ secrets.PROJECT_MANAGER_PRIVATE_KEY }} | ||
|
||
- name: Add to project | ||
if: steps.check-if-should-add.outputs.should_add_to_project == 'true' | ||
uses: actions/[email protected] | ||
with: | ||
# Add to the Community Contributions project | ||
project-url: https://github.com/orgs/silverstripe/projects/4 | ||
github-token: ${{ steps.generate-token.outputs.token }} |