resource-published #13404
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
name: Pre-build the seach index and update RSS/Atom feeds | |
on: | |
repository_dispatch: | |
types: | |
- resource-published | |
pull_request: | |
paths: | |
- '.github/ci/**' | |
- '.github/workflows/pre-build-search-index.yaml' | |
env: | |
TARGETDIRECTORY: "../.." | |
# concurrency: | |
# group: ${{ github.workflow }}-${{ github.ref }} | |
# cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
# The bot uses a PAT token currently assigned to ramboz to commit the changes. | |
# To change this token, a new personal access token must be created from: | |
# https://github.com/settings/tokens | |
# The token is then stored in the secrets of the this repository. | |
# See https://github.com/hlxsites/petplace/settings/secrets/actions | |
token: ${{ secrets.BOT_ACCESS_TOKEN }} | |
- run: | | |
echo "Status: ${{ github.event.client_payload.status }}" | |
echo "Path: ${{ github.event.client_payload.path }}" | |
- name: Configure git | |
run: | | |
git config user.name "Petplace - GitHub Action" | |
git config user.email "<>" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
working-directory: ./.github/ci | |
run: npm install | |
- name: Generate the search index | |
working-directory: ./.github/ci | |
run: node build-search-index.js ${{ env.TARGETDIRECTORY }} ${{ github.event.client_payload.path }} | |
- name: Generate the RSS/Atom feed | |
working-directory: ./.github/ci | |
run: node generate-news-feed.js ${{ env.TARGETDIRECTORY }} ${{ github.event.client_payload.path }} | |
- name: Commit and push changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
file_pattern: 'search-index*.db rss*.xml atom*.xml' | |
commit_message: "chore: update the search index and rss/atom feeds" |