Skip to content

Commit

Permalink
ci: automatically create PR to update Go versions (#308)
Browse files Browse the repository at this point in the history
Removes the issue-creation in the Go versions workflow, replacing it by creating a PR directly.
  • Loading branch information
cwaldren-ld authored Feb 12, 2024
1 parent 02bafdb commit 47dd6ed
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/update_go_versions.md

This file was deleted.

51 changes: 36 additions & 15 deletions .github/workflows/check-go-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
check-go-eol:
needs: go-versions
permissions:
issues: write
contents: read
contents: write
pull-requests: write
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
Expand All @@ -36,17 +36,38 @@ jobs:
echo "officialLatestVersion=${{ fromJSON(env.fetch-api-data)[0].latest }}" >> $GITHUB_ENV
echo "officialPenultimateVersion=${{ fromJSON(env.fetch-api-data)[1].latest }}" >> $GITHUB_ENV
# If the latest official Go version is different from Relay's release version, generate an issue
# with useful details.
- name: Create issue if update required
if: inputs.force_create_issue || (needs.go-versions.outputs.latest != env.officialLatestVersion)
uses: JasonEtco/create-an-issue@e27dddc79c92bc6e4562f268fffa5ed752639abd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELAY_LATEST_VERSION: ${{ needs.go-versions.outputs.latest }}
OFFICIAL_LATEST_VERSION: ${{ env.officialLatestVersion }}
RELAY_PENULTIMATE_VERSION: ${{ needs.go-versions.outputs.penultimate }}
OFFICIAL_PENULTIMATE_VERSION: ${{ env.officialPenultimateVersion }}
- name: Run update script
if: needs.go-versions.outputs.latest != env.officialLatestVersion
id: update
run: ./scripts/update-go-release-version.sh ${{ env.officialLatestVersion }} ${{ env.officialPenultimateVersion }} \

- name: Create pull request
if: steps.update.outcome == 'success'
uses: peter-evans/create-pull-request@v6
with:
filename: .github/ISSUE_TEMPLATE/update_go_versions.md
update_existing: true
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
Dockerfile
.github/variables/go-versions.env
branch: "launchdarklyreleasebot/update-to-go-${{ env.officialLatestVersion }}"
author: "LaunchDarklyReleaseBot <[email protected]>"
committer: "LaunchDarklyReleaseBot <[email protected]>"
title: "fix(deps): bump supported Go versions to ${{ env.officialLatestVersion }} and ${{ env.officialPenultimateVersion }}"
commit-message: "Bumps from Go ${{ needs.go-versions.outputs.latest }} -> ${{ env.officialLatestVersion }} and ${{ needs.go-versions.outputs.penultimate }} -> ${{ env.officialPenultimateVersion }}."
body: |
It's time to update Relay's supported Go versions, due to a recent upstream Go release.
The Go major release cadence is ~every 6 months; the two most recent major versions are supported.
Note that between major releases, the Go team often ships multiple minor versions.
| | Current repo configuration | Desired repo configuration |
|-------------|------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| Latest | ${{ needs.go-versions.outputs.latest }} | [${{ env.officialLatestVersion }}](https://go.dev/doc/devel/release#go${{ env.officialLatestVersion }}) |
| Penultimate | ${{ needs.go-versions.outputs.penultimate }}| [${{ env.officialPenultimateVersion }}](https://go.dev/doc/devel/release#go${{ env.officialPenultimateVersion }}) |
Run locally:
```bash
./scripts/update-go-release-version.sh ${{ env.officialPenultimateVersion }} ${{ env.officialPenultimateVersion }}
```

0 comments on commit 47dd6ed

Please sign in to comment.