-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Create a workflow to open pull request
- Loading branch information
Showing
3 changed files
with
51 additions
and
22 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 |
---|---|---|
@@ -1,49 +1,44 @@ | ||
name: 🔨 Build Test | ||
name: "Build Test" | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_dispatch: null | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
- feature* | ||
- feature/** | ||
- hotfix/** | ||
- bug/** | ||
paths: | ||
- '**.go' | ||
- '**.mod' | ||
|
||
jobs: | ||
build: | ||
name: Test Builds | ||
runs-on: ${{ matrix.os }} | ||
runs-on: '${{ matrix.os }}' | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macOS-12 ] | ||
go-version: [ 1.21.x ] | ||
os: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macOS-12 | ||
go-version: | ||
- 1.21.x | ||
steps: | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
go-version: '${{ matrix.go-version }}' | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
uses: actions/checkout@v4 | ||
- name: Build | ||
run: go build . | ||
working-directory: cmd/hednsextractor/ | ||
|
||
- name: Test | ||
run: go test ./... | ||
working-directory: . | ||
|
||
- name: Install | ||
run: go install | ||
working-directory: cmd/hednsextractor/ | ||
|
||
- name: Race Condition Tests | ||
run: go build -race . | ||
working-directory: cmd/hednsextractor/ | ||
|
||
|
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
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,34 @@ | ||
name: Open Pull Request on Develop | ||
|
||
on: | ||
push: | ||
branches: | ||
- feature/* | ||
|
||
jobs: | ||
open_pull_request: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check if PR exists | ||
id: check_pr | ||
run: | | ||
PR_EXIST=$(gh pr list --state open --base develop --head "$(echo "${GITHUB_REF}" | sed -E 's/refs\/heads\/feature\/(.*)/\1/')") | ||
if [[ -z $PR_EXIST ]]; then | ||
echo "::set-output name=pr_exists::false" | ||
else | ||
echo "::set-output name=pr_exists::true" | ||
fi | ||
env: | ||
GH_TOKEN: ${{ secrets.API_TOKEN_GITHUB }} | ||
|
||
- name: Create PR | ||
if: steps.check_pr.outputs.pr_exists == 'false' | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.API_TOKEN_GITHUB }} | ||
branch: develop | ||
title: "Merge feature branch" | ||
body: "This pull request merges the changes from the feature branch into develop." |