Skip to content

chore: 🐝 Update SDK - 1 - Generate 1.4.1 #211

chore: 🐝 Update SDK - 1 - Generate 1.4.1

chore: 🐝 Update SDK - 1 - Generate 1.4.1 #211

Workflow file for this run

name: 2 - PR Updater
on:
workflow_dispatch: {}
pull_request: {}
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
version-update:
name: Automatic Version Updater
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4
- name: Get Speakeasy version
id: speakeasy_version
run: |
VERSION=$(./scripts/get-speakeasy-sdk-version.sh)
echo "speakeasy_version=$VERSION" >> $GITHUB_OUTPUT
- name: Get .NET package version
id: dotnet_proj_version
run: |
VERSION=$(./scripts/get-csproj-version.sh Styra/Opa/Styra.Opa.csproj)
echo "dotnet_proj_version=$VERSION" >> $GITHUB_OUTPUT
- name: Checkout PR
if: ${{ steps.speakeasy_version.outputs.speakeasy_version != steps.dotnet_proj_version.outputs.dotnet_proj_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Add comment to PR thread
if: ${{ steps.speakeasy_version.outputs.speakeasy_version != steps.dotnet_proj_version.outputs.dotnet_proj_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo ':information_source: This PR has been updated with an automated commit. Please Close and Reopen the PR to trigger normal CI checks.' >> comment.txt
echo '' >> comment.txt
echo 'To fetch the new commits down for local use, try the following git operations:' >> comment.txt
echo '```' >> comment.txt
echo 'git fetch origin refs/pull/${{ github.event.pull_request.number }}/head:pr_${{ github.event.pull_request.number }}' >> comment.txt
echo 'git merge pr_${{ github.event.pull_request.number }}' >> comment.txt
echo '```' >> comment.txt
gh pr comment ${{ github.event.pull_request.number }} --body-file comment.txt
- name: Compare the two. Forcibly update with a commit if there's a diff.
if: ${{ steps.speakeasy_version.outputs.speakeasy_version != steps.dotnet_proj_version.outputs.dotnet_proj_version }}
run: |
SE_VERSION=${{ steps.speakeasy_version.outputs.speakeasy_version }}
DOTNET_VERSION=${{ steps.dotnet_proj_version.outputs.dotnet_proj_version }}
echo "Version mismatch. Speakeasy ver: ${SE_VERSION}, .NET project ver: ${DOTNET_VERSION}"
echo "Updating the .NET project version..."
sed -i "s/<Version>[^<]*<\/Version>/<Version>${SE_VERSION}<\/Version>/" Styra/Opa/Styra.Opa.csproj
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add Styra/Opa/Styra.Opa.csproj
git commit -am "Update project file to version ${SE_VERSION}"
git push
docs-updates-needed:
name: Docs Update Check
runs-on: ubuntu-latest
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4
- name: Patch Speakeasy README docs links
run: ./scripts/patch-readme.sh README.md http://localhost:8000
- name: Check for any unpatched docs links
run: ./scripts/find-unpatched-links.sh README.md
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build
smoke-test:
name: Smoke Test
runs-on: ubuntu-latest
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Install dependencies
run: dotnet restore
- name: Test
run: dotnet test
env:
EOPA_LICENSE_TOKEN: ${{ secrets.EOPA_LICENSE_TOKEN }}
timeout-minutes: 5