Update One Pace episodes #6053
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: Update One Pace episodes | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: 0 * * * * | |
workflow_dispatch: | |
jobs: | |
scrape: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
message: ${{ steps.commit.outputs.pushed && steps.scrape.outputs.message }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Checkout subtitles repo | |
uses: actions/checkout@v4 | |
with: | |
repository: one-pace/one-pace-public-subtitles | |
path: scripts/subtitles | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- name: Setup FFmpeg | |
uses: federicocarboni/setup-ffmpeg@v3 | |
- name: Install dependencies | |
run: npm ci | |
- name: Generate GraphQL types | |
run: npm run generate | |
- name: Get current date | |
id: date | |
run: | | |
echo "utc=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT" | |
- name: Restore torrent files | |
id: cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: cache | |
key: torrents-${{ steps.date.outputs.utc }} | |
restore-keys: | | |
torrents- | |
- name: Scrape One Pace website | |
id: scrape | |
run: | | |
echo "message<<EOF" >> "$GITHUB_OUTPUT" | |
npm run --silent scrape | sed 's/$/<br>/g' >> "$GITHUB_OUTPUT" | |
echo "EOF" >> "$GITHUB_OUTPUT" | |
- name: Cache torrent files | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: cache | |
key: ${{ steps.cache.outputs.cache-primary-key }} | |
- name: Commit changes | |
id: commit | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: Update One Pace episodes | |
default_author: github_actions | |
notify: | |
runs-on: ubuntu-latest | |
needs: | |
- scrape | |
if: needs.scrape.outputs.message | |
steps: | |
- name: Send message to Matrix | |
uses: s3krit/[email protected] | |
with: | |
server: ${{ vars.MATRIX_SERVER }} | |
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
room_id: ${{ vars.MATRIX_ROOM_ID }} | |
message: ${{ needs.scrape.outputs.message }} |