Skip to content

Publish internet-archive by @johannawild #23

Publish internet-archive by @johannawild

Publish internet-archive by @johannawild #23

Workflow file for this run

name: Publish Tool
run-name: Publish ${{ inputs.toolName }} by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
toolName:
description: 'Tool Name'
type: string
required: true
jobs:
publish-tool:
runs-on: ubuntu-latest
env:
TOOL_NAME: ${{ inputs.toolName }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: main
- name: Install dependencies
run: npm install
- name: Publish tool
id: publish
run: |
node src/publish-tool.mjs "$TOOL_NAME"
npm run build
if [ -n "$(git status --porcelain)" ]; then
echo "changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit changes ${{ steps.publish.outputs.changes }}
if: ${{ steps.publish.outputs.changes == 'true' }}
run: |
git status --porcelain
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Publish Tool: $TOOL_NAME"
- name: Push changes
if: ${{ steps.publish.outputs.changes == 'true' }}
uses: ad-m/github-push-action@master
with:
branch: publish-${{ github.run_number }}
force: true
- name: Create Pull Request
if: ${{ steps.publish.outputs.changes == 'true' }}
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: publish-${{ github.run_number }}
commit-message: Publish ${{ inputs.toolName }}
title: Publish ${{ inputs.toolName }}
body: Created via publish workflow. In case of merge conflicts, re-run all jobs on [Run ${{ github.run_number }}](https://github.com/bellingcat/toolkit/actions/runs/${{ github.run_id }}).