Skip to content

Trigger Update Nodes Workflow #17

Trigger Update Nodes Workflow

Trigger Update Nodes Workflow #17

Workflow file for this run

name: Remove Duplicate Nodes
on:
push:
branches:
- main
jobs:
remove_duplicates:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Dependencies
run: pip install -r requirements.txt
- name: Run Python Script
run: python remove_duplicates.py
- name: Commit Changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add .
git diff-index --quiet HEAD || git commit -m "Remove duplicate nodes"
git push
- name: Trigger Update Nodes Workflow
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: workflows } = await github.actions.listRepoWorkflows({
owner: context.repo.owner,
repo: context.repo.repo
});
const updateNodesWorkflow = workflows.workflows.find(workflow => workflow.name === 'Update Nodes');
await github.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: updateNodesWorkflow.id
});