Bump Cache Version #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bump Cache Version | |
on: | |
workflow_dispatch: | |
inputs: | |
cache_version: | |
description: 'New @useblacksmith/cache version' | |
required: true | |
type: string | |
jobs: | |
bump-cache-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update package.json | |
run: | | |
sed -i 's/"@actions\/cache": "npm:@useblacksmith\/cache@[^"]*"/"@actions\/cache": "npm:@useblacksmith\/cache@${{ github.event.inputs.cache_version }}"/' package.json | |
- name: Install dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Check for changes | |
id: git-check | |
run: | | |
git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
if: steps.git-check.outputs.changes == 'true' | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Bump @actions/cache version to ${{ github.event.inputs.cache_version }}" | |
title: "Bump @actions/cache version to ${{ github.event.inputs.cache_version }}" | |
body: | | |
This PR updates the @actions/cache version to ${{ github.event.inputs.cache_version }}. | |
Automated changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action | |
branch: bump-cache-version | |
base: main | |
delete-branch: true | |
- name: Check PR creation | |
if: steps.git-check.outputs.changes == 'true' | |
run: | | |
echo "Pull request created successfully" | |
- name: No changes detected | |
if: steps.git-check.outputs.changes != 'true' | |
run: | | |
echo "No changes detected. Skipping PR creation." |