mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 08:25:07 +03:00
Only post discord messages for new pkgs
This commit is contained in:
parent
9556685805
commit
abeb21a81d
1 changed files with 18 additions and 2 deletions
20
.github/workflows/cd.yml
vendored
20
.github/workflows/cd.yml
vendored
|
@ -42,14 +42,30 @@ jobs:
|
||||||
needs: [pkg, ingest]
|
needs: [pkg, ingest]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: make paylaod
|
- run: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: check if new pkgs
|
||||||
|
id: check-new-files
|
||||||
|
run: |
|
||||||
|
NEW_FILES=$(git diff --name-status HEAD $(git merge-base HEAD origin/main) | grep '^A\s*projects/.+?/package\.yml$' | wc -l)
|
||||||
|
|
||||||
|
if [ "$NEW_FILES" -gt 0 ]; then
|
||||||
|
echo "New files were added in this push."
|
||||||
|
echo "::set-output name=new_files::true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: make payload
|
||||||
run: |
|
run: |
|
||||||
RV=""
|
RV=""
|
||||||
for x in ${{ needs.ingest.outputs.projects }}; do
|
for x in ${{ needs.ingest.outputs.projects }}; do
|
||||||
RV="${RV:+$RV,} {\"title\": \"$x\", \"url\": \"https://pkgx.dev/pkgs/$x\"}"
|
RV="${RV:+$RV,} {\"title\": \"$x\", \"url\": \"https://pkgx.dev/pkgs/$x/\"}"
|
||||||
done
|
done
|
||||||
echo "{\"embeds\": [$RV], \"content\": \"new pkgs\"}" >> payload.json
|
echo "{\"embeds\": [$RV], \"content\": \"new pkgs\"}" >> payload.json
|
||||||
|
|
||||||
- uses: tsickert/discord-webhook@v5.4.0
|
- uses: tsickert/discord-webhook@v5.4.0
|
||||||
|
if: steps.check-new-files.outputs.new_files == 'true'
|
||||||
with:
|
with:
|
||||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
raw-data: ./payload.json
|
raw-data: ./payload.json
|
||||||
|
|
Loading…
Reference in a new issue