Skip to content
This repository was archived by the owner on Nov 2, 2021. It is now read-only.

Commit ffabbc0

Browse files
committed
add
1 parent 7033e90 commit ffabbc0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Synchronize the example with the template
2+
on:
3+
schedule:
4+
# every hour
5+
- cron: "0 * * * *"
6+
7+
jobs:
8+
remind_token:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: install cargo generate
12+
uses: actions-rs/install@v0.1
13+
with:
14+
crate: cargo-generate
15+
version: latest
16+
17+
- name: Create new example
18+
run: |
19+
cargo generate --git https://github.com/rust-github/template.git --name rust-gh-example
20+
cd rust-gh-example
21+
22+
- name: replace username
23+
run: |
24+
sed -i 's#{\[username\]}#MyUsername#g' $(find . -type f -name '*.md' -o -name '*.yml' -o -name '*.toml')
25+
cd ..
26+
27+
- name: Checkout old example
28+
uses: actions/checkout@v2
29+
with:
30+
repository: rust-github/rust-gh-example
31+
path: old_example
32+
33+
- name: move sources from old to new example
34+
run: |
35+
rm rust-gh-example/src/main.rs
36+
cp old_example/src/* rust-gh-example/src/
37+
38+
- name: update example
39+
run: |
40+
cd old_example
41+
git config user.name github-actions
42+
git config user.email github-actions@github.com
43+
git add .
44+
if [ -n "$(git status --porcelain)" ]; then
45+
git commit -m "automatic update" -m "from $GITHUB_REPOSITORY@$GITHUB_SHA"
46+
git push
47+
else
48+
echo "nothing to commit";
49+
fi

0 commit comments

Comments
 (0)