Open Go Update PR #78
This file contains hidden or 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
| name: Open Go Update PR | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| go_version: | |
| description: 'Go version' | |
| required: true | |
| type: string | |
| open_pr: | |
| description: 'Whether to open a PR' | |
| required: false | |
| type: boolean | |
| default: true | |
| draft: | |
| description: 'Open a Draft PR' | |
| required: false | |
| type: boolean | |
| default: false | |
| branch: | |
| description: 'Git branch to use (defaults to "gobot/go-update-<go_version>")' | |
| required: false | |
| type: string | |
| default: '' | |
| permissions: {} | |
| env: | |
| BRANCH_NAME: ${{ inputs.branch || format('gobot/go-update-{0}', inputs.go_version) }} | |
| jobs: | |
| open-go-update-pr: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # push commit and branch | |
| id-token: write # needed for dd-octo-sts token exchange | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| - name: Setup Python and pip | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: "3.12" | |
| - name: Get access token via dd-octo-sts | |
| uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3 | |
| id: octo-sts | |
| with: | |
| scope: DataDog/datadog-agent-buildimages | |
| policy: self.go-update.create-pr | |
| - name: Install dependencies | |
| run: | | |
| DDA_VERSION=$(grep DDA_VERSION dda.env | awk -F= '/^DDA_VERSION=/ {print $2}') | |
| python3 -m pip install "git+https://github.com/DataDog/datadog-agent-dev.git@${DDA_VERSION}" | |
| python3 -m dda -v self dep sync -f legacy-build | |
| - name: Update Go version | |
| run: | | |
| dda run update go "${{ inputs.go_version }}" --check-archive | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
| if: ${{ inputs.open_pr }} | |
| with: | |
| token: ${{ steps.octo-sts.outputs.token }} | |
| commit-message: "[push_to_datadog_agent] Update go version to ${{ inputs.go_version }}" | |
| branch: ${{ env.BRANCH_NAME }} | |
| sign-commits: true | |
| title: "Update Go version to ${{ inputs.go_version }}" | |
| body: | | |
| ## Update docker images to Go ${{ inputs.go_version }} | |
| For more information about this version, see the [Go release notes](https://golang.org/doc/devel/release.html#go${{ inputs.go_version }}) and the [Github milestone](https://github.com/golang/go/issues?q=milestone%3AGo${{ inputs.go_version }}+label%3ACherryPickApproved) | |
| draft: ${{ inputs.draft }} |