Skip to content

Updater

Updater #428

Workflow file for this run

name: Updater
on:
schedule:
- cron: 0 3 * * 1-5
workflow_dispatch: {}
permissions: read-all
jobs:
updater:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: arduino/setup-task@v2
- run: task run
env:
AIVEN_TOKEN: ${{ secrets.AIVEN_TOKEN }}
AIVEN_PROJECT_NAME: ${{ secrets.AIVEN_PROJECT_NAME }}
- id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- id: create_pr
uses: peter-evans/create-pull-request@v7
with:
author: GitHub <noreply@github.com>
body: >
automated changes by
[updater](https://github.com/aiven/go-api-schemas/blob/main/.github/workflows/updater.yml)
GitHub Actions workflow
branch: updater/${{ steps.date.outputs.date }}-${{ github.run_id }}
commit-message: "chore(updater): bump pkg/dist/*.yml (${{ steps.date.outputs.date }})"
title: "chore(updater): bump pkg/dist/*.yml (${{ steps.date.outputs.date }})"
labels: |
schema bump
automated pr
- name: Close previous update PRs
if: steps.create_pr.outputs.pull-request-operation == 'created'
run: |
new_pr_number=${{ steps.create_pr.outputs.pull-request-number }}
prs=$(gh pr list --state open --json number,headRefName --jq '.[] | select(.headRefName | startswith("updater/")) | .number')
for pr in $prs; do
if [ "$pr" != "$new_pr_number" ]; then
gh pr close $pr --comment "Auto-closing pull request in favor of #$new_pr_number" --delete-branch
fi
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}