Skip to content

Commit ac07b7c

Browse files
authored
single workflow to push new commits and history (#33)
1 parent 447095a commit ac07b7c

File tree

2 files changed

+55
-62
lines changed

2 files changed

+55
-62
lines changed
Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,62 @@
1-
name: Queue Historic Commits From Bevy Main
1+
name: Queue Commits From Bevy Main
22

33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: "15 */3 * * *"
7-
8-
env:
9-
COMMIT_DEPTH: 500
6+
- cron: "0 * * * *"
107

118
jobs:
9+
queue-latest-commit:
10+
name: Queue Latest Commit
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout Bevy main branch
16+
uses: actions/checkout@v4
17+
with:
18+
repository: "bevyengine/bevy"
19+
ref: "main"
20+
- uses: actions/checkout@v4
21+
with:
22+
ref: "queue"
23+
path: "queue"
24+
- uses: actions/checkout@v4
25+
with:
26+
ref: "results"
27+
path: "results"
28+
- name: Queue latest commit
29+
id: queue
30+
run: |
31+
gitref=`git rev-parse HEAD`
32+
if ls queue/$gitref 1> /dev/null 2>&1
33+
then
34+
echo "commit already queued"
35+
echo "ADDED=0" >> "$GITHUB_OUTPUT"
36+
fi
37+
if find results/ | grep $gitref 1> /dev/null 2>&1
38+
then
39+
echo "commit already collected"
40+
echo "ADDED=0" >> "$GITHUB_OUTPUT"
41+
fi
42+
cd queue
43+
touch $gitref
44+
echo "ADDED=1" >> "$GITHUB_OUTPUT"
45+
- name: Commit
46+
if: steps.queue.outputs.ADDED > 0
47+
run: |
48+
cd queue
49+
git config user.name 'Workflow'
50+
git config user.email '<>'
51+
52+
git add .
53+
git commit -m "Queue ${{ steps.queue.outputs.ADDED }} historic commits"
54+
git push
55+
1256
check-queue:
1357
name: Check Queue
1458
runs-on: ubuntu-latest
59+
needs: [queue-latest-commit]
1560
outputs:
1661
queue_is_empty: ${{ steps.check_queue.outputs.QUEUE_IS_EMPTY }}
1762
steps:
@@ -29,10 +74,10 @@ jobs:
2974
echo "QUEUE_IS_EMPTY=false" >> "$GITHUB_OUTPUT"
3075
fi
3176
32-
queue-commits:
77+
queue-history-commits:
3378
needs: [check-queue]
3479
if: needs.check-queue.outputs.queue_is_empty == 'true'
35-
name: Queue Commits
80+
name: Queue History Commits
3681
runs-on: ubuntu-latest
3782
permissions:
3883
contents: write
@@ -43,7 +88,7 @@ jobs:
4388
repository: "bevyengine/bevy"
4489
ref: "main"
4590
path: "bevy"
46-
fetch-depth: ${{ env.COMMIT_DEPTH }}
91+
fetch-depth: 500
4792
- uses: actions/checkout@v4
4893
with:
4994
ref: "queue"
@@ -52,13 +97,13 @@ jobs:
5297
with:
5398
ref: "results"
5499
path: "results"
55-
- name: Queue historic commits
100+
- name: Queue history commits
56101
id: queue
57102
run: |
58103
cd bevy
59104
i=0
60105
max=3
61-
for commit in `git log --no-abbrev-commit --pretty=oneline | sort | cut -d ' ' -f 1 | head -n ${{ env.COMMIT_DEPTH }}`
106+
for commit in `git log --no-abbrev-commit --pretty=oneline | sort | cut -d ' ' -f 1`
62107
do
63108
if find ../results/ | grep $commit 1> /dev/null 2>&1
64109
then
@@ -73,7 +118,6 @@ jobs:
73118
done
74119
echo "Added $i commits"
75120
echo "ADDED=$i" >> "$GITHUB_OUTPUT"
76-
77121
- name: Commit
78122
if: steps.queue.outputs.ADDED > 0
79123
run: |

.github/workflows/queue_new_commit.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)