libretime/.github/workflows/api-schema.yml
renovate[bot] 0b5d63c547
chore(deps): update actions/cache action to v4 (#2906)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/cache](https://togithub.com/actions/cache) | action | major |
`v3` -> `v4` |

---

### Release Notes

<details>
<summary>actions/cache (actions/cache)</summary>

### [`v4`](https://togithub.com/actions/cache/compare/v3...v4)

[Compare Source](https://togithub.com/actions/cache/compare/v3...v4)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/libretime/libretime).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzUuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzNS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-19 17:05:01 +00:00

108 lines
2.8 KiB
YAML

name: API schema
on:
workflow_dispatch:
push:
branches: [main]
paths:
- .github/workflows/api-schema.yml
- api/**
pull_request:
branches: [main]
paths:
- .github/workflows/api-schema.yml
- api/**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-api-${{ hashFiles('api/**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-api
- name: Install
run: make install
working-directory: api
- name: Get pull request commit range
if: github.event_name == 'pull_request'
run: echo "COMMIT_RANGE=origin/${{ github.base_ref }}..${{ github.sha }}" >> $GITHUB_ENV
- name: Get push commit range
if: github.event_name == 'push'
run: echo "COMMIT_RANGE=${{ github.event.before }}..${{ github.sha }}" >> $GITHUB_ENV
- name: Check if schema is outdated
run: |
for commit in $(git rev-list --reverse --no-merges ${{ env.COMMIT_RANGE }}); do
git checkout $commit
make --quiet schema
git diff -- schema.yml
git add schema.yml
git diff-index --quiet HEAD -- || {
echo "ERROR: Schema is outdated for commit $commit"
git show --quiet
exit 1
}
done
working-directory: api
dispatch:
if: >
github.repository_owner == 'libretime'
&& github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: libretime/client
path: client
ssh-key: "${{ secrets.API_CLIENT_DEPLOY_KEY }}"
- name: Dispatch schema update commits
run: |
git config --global user.name "libretime-bot"
git config --global user.email "libretime-bot@users.noreply.github.com"
for commit in $(git rev-list --reverse --no-merges ${{ github.event.before }}..${{ github.sha }} -- api/schema.yml); do
cp api/schema.yml client/
git show \
--quiet \
--format="%B%n${{ github.repository }}@%H" \
"$commit" \
> commit-message
pushd client/
git add schema.yml
git diff-index --quiet HEAD -- || {
git commit --file=../commit-message
git push
}
popd
rm commit-message
done