diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index aac400e..d2ecf0e 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -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/ - - diff --git a/.github/workflows/dep-auto-merge.yml b/.github/workflows/dep-auto-merge.yml index 84b26e1..726b4ee 100644 --- a/.github/workflows/dep-auto-merge.yml +++ b/.github/workflows/dep-auto-merge.yml @@ -23,4 +23,4 @@ jobs: - uses: ahmadnassri/action-dependabot-auto-merge@v2 with: github-token: ${{ secrets.DEPENDABOT_PAT }} - target: all \ No newline at end of file + target: all diff --git a/.github/workflows/feature.yaml b/.github/workflows/feature.yaml new file mode 100644 index 0000000..7d4cbcc --- /dev/null +++ b/.github/workflows/feature.yaml @@ -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."