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
|
||||
on:
|
||||
schedule:
|
||||
# Run at 11 o'clock every day
|
||||
- cron: "37 14 * * *"
|
||||
# Run at 11 o'clock every wednesday
|
||||
- cron: "00 11 * * 3"
|
||||
|
||||
jobs:
|
||||
npins_update:
|
||||
|
@ -12,6 +12,8 @@ jobs:
|
|||
run: apt-get update && apt-get install sudo
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
depth: 0
|
||||
|
||||
- uses: https://github.com/cachix/install-nix-action@v22
|
||||
with:
|
||||
|
@ -25,21 +27,31 @@ jobs:
|
|||
run: |
|
||||
npins update
|
||||
|
||||
if [ ! -z "$(git diff --name-only HEAD)" ]; then
|
||||
if [ ! -z "$(git diff --name-only)" ]; then
|
||||
echo "[+] Changes detected, pushing updates."
|
||||
|
||||
git switch -C npins-update
|
||||
|
||||
git add npins
|
||||
|
||||
git config user.name "DGNum Chores"
|
||||
git config user.email "tech@dgnum.eu"
|
||||
|
||||
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
|
||||
tea login add \
|
||||
-n dgnum-chores \
|
||||
-t {{ secrets.TEA_DGNUM_CHORES_TOKEN }} \
|
||||
-t '${{ secrets.TEA_DGNUM_CHORES_TOKEN }}' \
|
||||
-u https://git.dgnum.eu
|
||||
|
||||
# Create a pull request if needed
|
||||
# i.e. no PR with the same title exists
|
||||
tea pulls ls -f='title,author' -o simple | grep -q 'chore(npins): Update dgnum-chores') \
|
||||
&& tea pulls create -D "Automatic npins update" -t "chore(npins): Update" --head chores/npins-update
|
||||
if [ -z "$(tea pr ls -f='title,author' -o simple | grep 'chore(npins): Update dgnum-chores')" ]; then
|
||||
tea pr create \
|
||||
--description "Automatic npins update" \
|
||||
--title "chore(npins): Update" \
|
||||
--head npins-update
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue