forked from DGNum/infrastructure
fix(workflows): ???
This commit is contained in:
parent
f8443e00d1
commit
c2435ee92b
1 changed files with 19 additions and 7 deletions
|
@ -1,8 +1,8 @@
|
||||||
name: npins update
|
name: npins update
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
# Run at 11 o'clock every day
|
# Run at 11 o'clock every wednesday
|
||||||
- cron: "37 14 * * *"
|
- cron: "00 11 * * 3"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
npins_update:
|
npins_update:
|
||||||
|
@ -12,6 +12,8 @@ jobs:
|
||||||
run: apt-get update && apt-get install sudo
|
run: apt-get update && apt-get install sudo
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
depth: 0
|
||||||
|
|
||||||
- uses: https://github.com/cachix/install-nix-action@v22
|
- uses: https://github.com/cachix/install-nix-action@v22
|
||||||
with:
|
with:
|
||||||
|
@ -25,21 +27,31 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
npins update
|
npins update
|
||||||
|
|
||||||
if [ ! -z "$(git diff --name-only HEAD)" ]; then
|
if [ ! -z "$(git diff --name-only)" ]; then
|
||||||
echo "[+] Changes detected, pushing updates."
|
echo "[+] Changes detected, pushing updates."
|
||||||
|
|
||||||
|
git switch -C npins-update
|
||||||
|
|
||||||
git add npins
|
git add npins
|
||||||
|
|
||||||
|
git config user.name "DGNum Chores"
|
||||||
|
git config user.email "tech@dgnum.eu"
|
||||||
|
|
||||||
git commit --message "chore(npins): Update"
|
git commit --message "chore(npins): Update"
|
||||||
git push --set-upstream chores/npins-update --force
|
git push --set-upstream origin npins-update --force
|
||||||
|
|
||||||
# Connect to the server with the cli
|
# Connect to the server with the cli
|
||||||
tea login add \
|
tea login add \
|
||||||
-n dgnum-chores \
|
-n dgnum-chores \
|
||||||
-t {{ secrets.TEA_DGNUM_CHORES_TOKEN }} \
|
-t '${{ secrets.TEA_DGNUM_CHORES_TOKEN }}' \
|
||||||
-u https://git.dgnum.eu
|
-u https://git.dgnum.eu
|
||||||
|
|
||||||
# Create a pull request if needed
|
# Create a pull request if needed
|
||||||
# i.e. no PR with the same title exists
|
# i.e. no PR with the same title exists
|
||||||
tea pulls ls -f='title,author' -o simple | grep -q 'chore(npins): Update dgnum-chores') \
|
if [ -z "$(tea pr ls -f='title,author' -o simple | grep 'chore(npins): Update dgnum-chores')" ]; then
|
||||||
&& tea pulls create -D "Automatic npins update" -t "chore(npins): Update" --head chores/npins-update
|
tea pr create \
|
||||||
|
--description "Automatic npins update" \
|
||||||
|
--title "chore(npins): Update" \
|
||||||
|
--head npins-update
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue