forked from actions/setup-python
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (40 loc) · 1.65 KB
/
bump-cache-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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: blacksmith
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'
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
git fetch origin main
git checkout main
git pull origin main
timestamp=$(date +%Y%m%d%H%M%S)
git checkout -b bump-cache-version-${{ github.event.inputs.cache_version }}-$timestamp
git add .
git commit -m "Bump @actions/cache version to ${{ github.event.inputs.cache_version }}"
git push origin bump-cache-version-${{ github.event.inputs.cache_version }}-$timestamp
gh pr create --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 }}"