-
Notifications
You must be signed in to change notification settings - Fork 18
57 lines (50 loc) · 2 KB
/
aggregator.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This workflow will do a clean install of node dependencies, build the source code and run the aggregator
# If no new posts are published then the workflow is cancelled
name: Aggregator
on:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#schedule
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 * * * *'
# Ability to trigger manually
# https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow-on-github
workflow_dispatch:
jobs:
build:
name: Check new posts and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: src
# Has to be jbossorg token because. otherwise other actions are not triggered e.g. Production CI
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
token: ${{ secrets.JBOSSORG_BOT }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 16
- name: install npm dependencies
run: npm install
- name: aggregate community blogs
run: npm run aggregate
- name: publish new posts
id: commit
run: |
git config user.name jbossorg-bot
git config user.email [email protected]
if [ -z "$(git status --porcelain)" ]; then
echo "Nothing to push"
echo "::set-output name=push::false"
else
git add --all
git commit -m "Published latest aggregated blog posts"
git push
echo "New posts pushed to git repo"
echo "::set-output name=push::true"
fi
shell: bash
# Disabled because cancelled jobs triggers e-mails notification
# - name: cancelling - no new posts
# if: steps.commit.outputs.push == 'false'
# uses: andymckay/[email protected]