File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Generate Image Preview
2
+ on :
3
+ pull_request :
4
+ types :
5
+ - opened
6
+ - synchronize
7
+ paths :
8
+ - ' content/**'
9
+
10
+ # cancel in-progress runs on new commits to same PR (github.event.number)
11
+ concurrency :
12
+ group : gen_preview_image${{ github.workflow }}-${{ github.event.number || github.sha }}
13
+ cancel-in-progress : true
14
+
15
+ jobs :
16
+ generate-preview :
17
+ runs-on : ubuntu-latest
18
+ name : Generate Preview Image
19
+ permissions : # Job-level permissions configuration starts here
20
+ contents : write # 'write' access to repository contents
21
+ pull-requests : write # 'write' access to pull requests
22
+ steps :
23
+ - uses : actions/checkout@v4
24
+ with :
25
+ persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
26
+ fetch-depth : 0 # otherwise, there would be errors pushing refs to the destination repository.
27
+ # Download bin of gen_preview
28
+ # TODO
29
+
30
+ - name : Get changed files
31
+ run : |
32
+ files=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD main))
33
+ preview ./crates/preview/assets/bg_preview.png ./public/previews $files
34
+ - name : Commit changes
35
+ run : |
36
+ git config --global user.name 'github-actions[bot]'
37
+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
38
+ git add -A
39
+ git commit -m "chore: generate opengraph image" || echo "No changes to commit"
40
+
41
+ - uses : ad-m/github-push-action@master
42
+ with :
43
+ branch : ${{ github.head_ref }}
44
+
You can’t perform that action at this time.
0 commit comments