Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Add missing commit steps
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed May 10, 2024
1 parent 1175ed4 commit 27a73c9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
name: 📸

on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
schedule:
# Every 10:42 JST
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
Expand All @@ -12,6 +20,16 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Prepare Git user
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Prepare Git branch
id: prepare-branch
run: |
started_at="$(date +%Y%m%d-%H%M%S)"
git switch -c "${{ github.sha }}-${started_at}"
echo started_at="$started_at" | tee -a "$GITHUB_OUTPUT"
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -23,3 +41,19 @@ jobs:
version: '3.36.0' # selfup {"extract":"\\d\\.\\d+\\.\\d+","replacer":["task", "--version"], "nth": 3}
- run: |
task snapshot | tee -a snapshot.txt
- name: Update related CI dependencies
run: |
git diff-index --quiet HEAD || git commit -m 'Update snapshots' snapshot.txt
- name: Count added commits
id: count-commits
run: |
count="$(git rev-list --count origin/${{ github.event.repository.default_branch }}..)"
echo "count=${count}" | tee -a "$GITHUB_OUTPUT"
- run: git push origin '${{ steps.prepare-branch.outputs.started_at }}'
if: ${{ github.event_name != 'pull_request' }} && (steps.count-commits.outputs.count > 0)
- name: Create PR
if: ${{ github.event_name != 'pull_request' }} && (steps.count-commits.outputs.count > 0)
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh pr create --base '${{ github.event.repository.default_branch }}' --title 'Update snapshots'

0 comments on commit 27a73c9

Please sign in to comment.