Skip to content

Commit

Permalink
fix(./,.github/workflows/,docs/): fix when CI runs
Browse files Browse the repository at this point in the history
  • Loading branch information
violetbrina committed Jan 15, 2025
1 parent b6451a2 commit 516eedd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
- alpha

push:
branches:
- main
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/package.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
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
contents: write

jobs:
package:
if: github.ref_name == 'main' || github.ref_name == 'alpha'
name: Package
environment: production
runs-on: ubuntu-latest
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/web-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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.<br/><br/>[![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` |

Expand Down
8 changes: 8 additions & 0 deletions docs/update_readme.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import re
import sys
from copy import deepcopy

import yaml

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 516eedd

Please sign in to comment.