Merge pull request #154 from bellingcat/publish-24 #857
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: Build | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: npm install | |
- name: Validate and format JSON | |
run: node src/lint-json.mjs | |
- name: Run node script to update categories | |
run: | | |
node src/categories.mjs | |
- name: Detect changes | |
uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
base: HEAD | |
filters: | | |
all: | |
- '**' | |
categories: | |
- 'gitbook/categories/**' | |
tools: | |
- 'gitbook/tools/**' | |
- name: Commit categories | |
if: steps.changes.outputs.categories == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add gitbook/categories | |
git commit -m "Build: Update Categories" | |
- name: Commit tools | |
if: steps.changes.outputs.tools == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add gitbook/tools | |
git commit -m "Build: Update Tools" | |
- name: Push changes | |
if: steps.changes.outputs.all == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
branch: build | |
force: true | |
- name: Create Pull Request | |
if: steps.changes.outputs.all == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: build | |
commit-message: "Build: Update all" | |
title: "Update Build" | |
body: "This pull request updates the build based on latest changes." |