Aggregator #33810
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] |