Files
git-cliff-action/.github/workflows/sync-git-cliff-version.yml
T
Seren_Modz 21 61c9254a8b ci(sync): resolve github cli login (#79)
Signed-off-by: Seren_Modz 21 <seren@kings-world.net>
2026-05-01 17:16:29 +03:00

69 lines
2.2 KiB
YAML

name: Sync git-cliff version
on:
schedule:
- cron: '0 3 * * 1' # every Monday at 03:00 UTC
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
check:
name: Check
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.2.2
- name: Get latest git-cliff release
id: latest
run: |
set -euo pipefail
VERSION=$(curl -s https://api.github.com/repos/orhun/git-cliff/releases/latest | jq -r .tag_name)
echo "version=${VERSION}" >> ${GITHUB_OUTPUT}
- name: Read current default version
id: current
run: |
set -euo pipefail
VERSION=$(yq '.inputs.version.default' action.yml)
echo "version=${VERSION}" >> ${GITHUB_OUTPUT}
- name: Bump version
if: steps.latest.outputs.version != steps.current.outputs.version
env:
CURRENT: ${{ steps.current.outputs.version }}
LATEST: ${{ steps.latest.outputs.version }}
run: |
set -euo pipefail
sed -i "s|${CURRENT}|${LATEST}|g" action.yml
sed -i "s|${CURRENT}|${LATEST}|g" README.md
- name: Create PR
if: steps.latest.outputs.version != steps.current.outputs.version
env:
LATEST: ${{ steps.latest.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
BRANCH="chore/git-cliff-${LATEST}"
TITLE="chore: bump git-cliff to ${LATEST}"
BODY="This PR bumps git-cliff to ${LATEST}.
🔗 https://github.com/orhun/git-cliff/releases/tag/${LATEST}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -B "${BRANCH}"
git add action.yml
git add README.md
git commit -m "${TITLE}" || echo "Nothing to commit"
git push origin "${BRANCH}" --force
gh pr create \
--base main \
--head "${BRANCH}" \
--title "${TITLE}" \
--body "${BODY}" \
|| echo "PR already exists"