Skip to content

Update schemas

Update schemas #573

name: Update schemas
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
jobs:
update-schemas:
name: Update schemas
runs-on: ubuntu-latest
steps:
- name: Check out project sources
uses: actions/checkout@v4
- name: Check for existing pull request
uses: juliangruber/find-pull-request-action@v1
id: find-existing-pull-request
with:
branch: prepare-release
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 21
- name: Set up Git user
run: |
git config --global user.name "pulumi-kotlin[bot]"
git config --global user.email "138587440+pulumi-kotlin[bot]@users.noreply.github.com"
- name: Get the id of last commit
id: get-id-of-last-commit
run: echo "last_commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Prepare release
if: ${{ steps.find-existing-pull-request.outputs.number == '' }}
run: ./gradlew prepareReleaseOfUpdatedSchemas -PskipPreReleaseVersions=true -PfastForwardToMostRecentVersion=false
- name: Check for commit
if: ${{ steps.find-existing-pull-request.outputs.number == '' }}
id: check-for-commit
run: |
previous_last_commit=${{ steps.get-id-of-last-commit.outputs.last_commit }}
current_last_commit=$(git rev-parse HEAD)
if [[ "$previous_last_commit" == "$current_last_commit" ]]; then found_new_versions=false; else found_new_versions=true; fi
echo "found_new_versions=$found_new_versions" >> $GITHUB_OUTPUT
- name: Get PR description
if: ${{ steps.find-existing-pull-request.outputs.number == '' && steps.check-for-commit.outputs.found_new_versions == 'true' }}
id: get-pr-description
run: |
commit_message=$(git log --format=%b -n 1 HEAD)
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "description<<$EOF" >> $GITHUB_OUTPUT
echo "$commit_message" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Generate GitHub app token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
if: ${{ steps.find-existing-pull-request.outputs.number == '' && steps.check-for-commit.outputs.found_new_versions == 'true' }}
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create pull request
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
if: ${{ steps.find-existing-pull-request.outputs.number == '' && steps.check-for-commit.outputs.found_new_versions == 'true' }}
with:
title: Release provider libraries
body: |
## Task
Resolves: None
## Description
${{ steps.get-pr-description.outputs.description }}
base: main
branch: prepare-release
token: ${{ steps.generate-token.outputs.token }}