diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 14407cb7..e2049adc 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -4,6 +4,7 @@ on: branches: - main - alpha + push: branches: - main diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 32357c26..68c14778 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -1,12 +1,14 @@ name: Package on: - # Building on pull-requests, manual dispatch, and pushes to main; but restricting - # publishing only to main pushes and manual dispatch with `if`s in specific steps. - workflow_dispatch: - workflow_run: - workflows: ["Test"] - types: - - completed + push: + branches: + - main + - alpha + + pull_request: + branches: + - main + - alpha permissions: id-token: write @@ -14,7 +16,6 @@ permissions: jobs: package: - if: github.ref_name == 'main' || github.ref_name == 'alpha' name: Package environment: production runs-on: ubuntu-latest diff --git a/.github/workflows/web-docs.yaml b/.github/workflows/web-docs.yaml index b2d92753..76029bcf 100644 --- a/.github/workflows/web-docs.yaml +++ b/.github/workflows/web-docs.yaml @@ -2,11 +2,15 @@ name: Deploy API Documentation on: - # Run after Test - workflow_run: - workflows: ["Test"] - types: - - completed + pull_request: + branches: + - main + - alpha + + push: + branches: + - main + - alpha # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -26,7 +30,6 @@ concurrency: jobs: # Single deploy job since we're just deploying deploy: - if: github.event.workflow_run.conclusion == 'success' && (github.base_ref == 'alpha' || github.base_ref == 'main') environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/README.md b/README.md index 113b14be..18c89197 100644 --- a/README.md +++ b/README.md @@ -260,9 +260,9 @@ You can find all the workflows in the **[.github/workflows directory](https://gi | **[Renovate](https://github.com/populationgenomics/cpg-flow/actions/workflows/renovate.yaml)** | Runs Renovate to update dependencies.

[![Renovate](https://github.com/populationgenomics/cpg-flow/actions/workflows/renovate.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/renovate.yaml) | `schedule` and `workflow_dispatch` | | **[Update Badges](https://github.com/populationgenomics/cpg-flow/actions/workflows/update-badges.yaml)** | Updates badges.yaml with test results and coverage.

[![Update Badges](https://github.com/populationgenomics/cpg-flow/actions/workflows/update-badges.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/update-badges.yaml) | `workflow_run` (completed) | | **[Test](https://github.com/populationgenomics/cpg-flow/actions/workflows/test.yaml)** | Runs unit tests and generates coverage reports.

[![Test](https://github.com/populationgenomics/cpg-flow/actions/workflows/test.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/test.yaml) | `push` | -| **[Deploy API Documentation](https://github.com/populationgenomics/cpg-flow/actions/workflows/web-docs.yaml)** | Deploys API documentation to GitHub Pages.

[![Deploy API Documentation](https://github.com/populationgenomics/cpg-flow/actions/workflows/web-docs.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/web-docs.yaml) | `workflow_run` (completed) and `workflow_dispatch` | +| **[Deploy API Documentation](https://github.com/populationgenomics/cpg-flow/actions/workflows/web-docs.yaml)** | Deploys API documentation to GitHub Pages.

[![Deploy API Documentation](https://github.com/populationgenomics/cpg-flow/actions/workflows/web-docs.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/web-docs.yaml) | `pull_request` on `main, alpha` and `push` on `main, alpha` and `workflow_dispatch` | | **[Security Checks](https://github.com/populationgenomics/cpg-flow/actions/workflows/security.yaml)** | Performs security checks using pip-audit.

[![Security Checks](https://github.com/populationgenomics/cpg-flow/actions/workflows/security.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/security.yaml) | `workflow_dispatch` and `push` | -| **[Package](https://github.com/populationgenomics/cpg-flow/actions/workflows/package.yaml)** | Packages the project and publishes it to PyPI and GitHub Releases.

[![Package](https://github.com/populationgenomics/cpg-flow/actions/workflows/package.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/package.yaml) | `workflow_dispatch` and `workflow_run` (completed) | +| **[Package](https://github.com/populationgenomics/cpg-flow/actions/workflows/package.yaml)** | Packages the project and publishes it to PyPI and GitHub Releases.

[![Package](https://github.com/populationgenomics/cpg-flow/actions/workflows/package.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/package.yaml) | `push` on `main, alpha` and `pull_request` on `main, alpha` | | **[Lint](https://github.com/populationgenomics/cpg-flow/actions/workflows/lint.yaml)** | Runs linting checks using pre-commit hooks.

[![Lint](https://github.com/populationgenomics/cpg-flow/actions/workflows/lint.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/lint.yaml) | `push` | | **[Docker](https://github.com/populationgenomics/cpg-flow/actions/workflows/docker.yaml)** | Builds and pushes Docker images for the project.

[![Docker](https://github.com/populationgenomics/cpg-flow/actions/workflows/docker.yaml/badge.svg)](https://github.com/populationgenomics/cpg-flow/actions/workflows/docker.yaml) | `pull_request` on `main, alpha` and `push` on `main, alpha` and `workflow_dispatch` | diff --git a/docs/update_readme.py b/docs/update_readme.py index 427de093..d6a4a7f7 100644 --- a/docs/update_readme.py +++ b/docs/update_readme.py @@ -1,5 +1,7 @@ import os import re +import sys +from copy import deepcopy import yaml @@ -81,13 +83,19 @@ def update_readme(readme_file): with open(readme_file) as file: content = file.read() + previous_content = deepcopy(content) content = update_workflow_table(content) content = update_readme_links(content) + if content == previous_content: + print('No changes detected in the README.md') + sys.exit(0) + with open(readme_file, 'w') as file: file.write(content) print(f'Readme updated: {readme_file}') + sys.exit(100) def update_workflow_table(content):