From 4d398f157258838f16e6550819418dd96e23f0e2 Mon Sep 17 00:00:00 2001 From: Sandra Rodgers Date: Wed, 24 Jul 2024 14:25:41 -0500 Subject: [PATCH 1/2] update github action --- .github/workflows/update-deepgram-sdk.yaml | 72 ++++++++++++---------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/.github/workflows/update-deepgram-sdk.yaml b/.github/workflows/update-deepgram-sdk.yaml index 6625625..685d8a3 100644 --- a/.github/workflows/update-deepgram-sdk.yaml +++ b/.github/workflows/update-deepgram-sdk.yaml @@ -30,30 +30,41 @@ jobs: - name: Check installed Deepgram SDK version id: check-installed-version run: | - INSTALLED_VERSION=$(go list -m github.com/deepgram/deepgram-go-sdk | cut -d' ' -f2) + INSTALLED_VERSION=$(go list -m -u github.com/deepgram/deepgram-go-sdk | grep deepgram-go-sdk | awk '{print $2}') echo "installed_version=$INSTALLED_VERSION" >> $GITHUB_ENV + - name: Config git + env: + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_ACCESS_TOKEN }} + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global init.defaultBranch main + git config --global pull.rebase true + git config --global url."https://git:$GITHUB_TOKEN@github.com".insteadOf "https://github.com" + - name: Compare versions and update if necessary + env: + GITHUB_TOKEN: ${{ secrets.GH_RELEASE_ACCESS_TOKEN }} run: | LATEST_VERSION=${{ env.version }} INSTALLED_VERSION=${{ env.installed_version }} - if [ "$LATEST_VERSION" != "$INSTALLED_VERSION" ]; then echo "Updating Deepgram SDK from $INSTALLED_VERSION to $LATEST_VERSION" go get github.com/deepgram/deepgram-go-sdk@$LATEST_VERSION # Update go.mod and go.sum go mod tidy - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' git add go.mod go.sum - # Check if there are changes to commit - if git diff-index --quiet HEAD --; then - echo "No changes to commit" - else - git commit -m "chore: update Deepgram SDK to $LATEST_VERSION" - fi + # Create a new branch and commit changes + BRANCH_NAME="update-deepgram-sdk-$LATEST_VERSION" + git checkout -b "$BRANCH_NAME" + git commit -m "chore: update Deepgram SDK to $LATEST_VERSION" + + # Push the new branch and create a PR + git push origin "$BRANCH_NAME" + gh pr create --title "chore: update Deepgram SDK to $LATEST_VERSION" --body "This PR updates the Deepgram SDK to version $LATEST_VERSION." --base "main" --head "$BRANCH_NAME" else echo "Deepgram SDK is up to date" fi @@ -62,29 +73,28 @@ jobs: run: go mod download - name: Run tests - id: run-tests env: DEEPGRAM_API_KEY: ${{ secrets.DEEPGRAM_API_KEY }} run: go test -v ./tests - # - name: Notify on failure - # if: failure() - # uses: slackapi/slack-github-action@v1.23.0 - # with: - # payload: | - # { - # "text": "The tests have FAILED for ${{ github.repository }}." - # } - # env: - # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + - name: Notify on failure + if: failure() + uses: slackapi/slack-github-action@v1.23.0 + with: + payload: | + { + "text": "The tests have FAILED for ${{ github.repository }}." + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - # - name: Notify on success - # if: success() - # uses: slackapi/slack-github-action@v1.23.0 - # with: - # payload: | - # { - # "text": "The tests have passed for ${{ github.repository }}." - # } - # env: - # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + - name: Notify on success + if: success() + uses: slackapi/slack-github-action@v1.23.0 + with: + payload: | + { + "text": "The tests have passed for ${{ github.repository }}." + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} From d8032c503bbf59004d0df555259a58bf3cf557ea Mon Sep 17 00:00:00 2001 From: Sandra Rodgers Date: Wed, 24 Jul 2024 14:36:48 -0500 Subject: [PATCH 2/2] turn off slack notification temporarily --- .github/workflows/update-deepgram-sdk.yaml | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/update-deepgram-sdk.yaml b/.github/workflows/update-deepgram-sdk.yaml index 685d8a3..1643911 100644 --- a/.github/workflows/update-deepgram-sdk.yaml +++ b/.github/workflows/update-deepgram-sdk.yaml @@ -77,24 +77,24 @@ jobs: DEEPGRAM_API_KEY: ${{ secrets.DEEPGRAM_API_KEY }} run: go test -v ./tests - - name: Notify on failure - if: failure() - uses: slackapi/slack-github-action@v1.23.0 - with: - payload: | - { - "text": "The tests have FAILED for ${{ github.repository }}." - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + # - name: Notify on failure + # if: failure() + # uses: slackapi/slack-github-action@v1.23.0 + # with: + # payload: | + # { + # "text": "The tests have FAILED for ${{ github.repository }}." + # } + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - - name: Notify on success - if: success() - uses: slackapi/slack-github-action@v1.23.0 - with: - payload: | - { - "text": "The tests have passed for ${{ github.repository }}." - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + # - name: Notify on success + # if: success() + # uses: slackapi/slack-github-action@v1.23.0 + # with: + # payload: | + # { + # "text": "The tests have passed for ${{ github.repository }}." + # } + # env: + # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}