This repository has been archived by the owner on Oct 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7d33329
Showing
1 changed file
with
32 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,32 @@ | ||
name: Check PR Requirements | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check-pr: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check for new root directory | ||
run: | | ||
NEW_DIRS=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^[^/]\+/$') | ||
TOTAL_CHANGES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | wc -l) | ||
DIR_COUNT=$(echo "$NEW_DIRS" | wc -l) | ||
if [[ -z "$NEW_DIRS" || "$DIR_COUNT" -ne 1 || "$TOTAL_CHANGES" -ne 1 ]]; then | ||
echo "PR must contain only one new root directory and no other changes!" | ||
exit 1 | ||
fi | ||
echo "New directory: $NEW_DIRS" | ||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.21' | ||
|
||
- name: Build Go Project in New Directory | ||
run: | | ||
cd $NEW_DIRS | ||
go build |