Skip to content

resource-published #4710

resource-published

resource-published #4710

name: Generate Atom news feed
on:
repository_dispatch:
types:
- resource-published
schedule:
# Runs daily in case any event was missed
- cron: '30 0 * * *'
pull_request:
paths:
- '.github/ci/**'
- '.github/workflows/generate-atom-news-feed.yaml'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# The bot user https://github.com/hlx-macktrucks-bot is used to commit the changes. The personal access token
# must be created from: https://github.com/settings/tokens
# The token is then stored in the secrets of the this.
# see https://github.com/hlxsites/vg-volvotrucks-us/settings/secrets/actions
# more info: https://stackoverflow.com/a/72515781/79461
token: ${{ secrets.ATOM_FEED_BOT_ACCESS_TOKEN }}
- name: Configure git
run: |
git config user.name "GitHubActions"
git config user.email "<>"
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
working-directory: ./.github/ci
run: npm install
- name: Generate Feed
working-directory: ./.github/ci
run: node generate-news-feed.js
env:
NEWS_ENDPOINT: ${{ vars.NEWS_ENDPOINT }}
NEWS_FEED_INFO_ENDPOINT: ${{ vars.NEWS_FEED_INFO_ENDPOINT }}
NEWS_TARGET_DIRECTORY: ${{ vars.NEWS_TARGET_DIRECTORY }}
- name: Print Feed
run: |
ls -la ${{ vars.NEWS_TARGET_FEED }}
head -20 ${{ vars.NEWS_TARGET_FEED }}
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: ${{ vars.NEWS_TARGET_FEED }}
commit_message: "Update feed.xml"