From 0fee40b83d5a8d3db3f2c030635f790a8685f5be Mon Sep 17 00:00:00 2001 From: ajlail98 <70709235+ajlail98@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:38:36 -0500 Subject: [PATCH 1/2] combine multiple actions into a workflow so they'll run sequentially --- .../workflows/generate_and_render_readme.yml | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/generate_and_render_readme.yml diff --git a/.github/workflows/generate_and_render_readme.yml b/.github/workflows/generate_and_render_readme.yml new file mode 100644 index 0000000..52bffbf --- /dev/null +++ b/.github/workflows/generate_and_render_readme.yml @@ -0,0 +1,100 @@ +# .github/workflows/generate_and_render_readme.yml + +name: Generate and Render README + +on: + pull_request: + branches: + - main + paths: + - DETECTION_RESULTS.tsv + - assets/positivity_tally.tsv + - .github/workflows/generate_tally.yml + - .github/workflows/generate_and_render_readme.yml + - .github/workflows/render_readme.yml + - scripts/splice_readme.py + +jobs: + generate-tally: + name: Generate Positivity Tally + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install Dependencies + run: | + pip install uv + uv venv + source .venv/bin/activate + uv pip install -r requirements.txt + + - name: Tally positive cartons per state + run: | + source .venv/bin/activate + python3 scripts/positivity_tally.py \ + DETECTION_RESULTS.tsv \ + assets/positivity_tally.tsv + + - name: Commit positivity tally + if: success() + run: | + git config --global user.name 'GitHub Actions Bot' + git config --global user.email 'actions@github.com' + git add assets/positivity_tally.tsv + git fetch origin proposals + git commit -m "Updating positivity tally" + git push --force-with-lease origin HEAD:proposals + render-readme: + name: Render new README + needs: generate-tally + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install Dependencies + run: | + pip install uv + uv venv + source .venv/bin/activate + uv pip install -r requirements.txt + + - name: Generate Markdown Table + run: | + source .venv/bin/activate + python3 scripts/tsv_to_md.py \ + assets/positivity_tally.tsv \ + > assets/positivity_tally.md + + - name: Splice Table into README + run: | + source .venv/bin/activate + python3 scripts/splice_readme.py + + - name: Replace previous README + run: | + rm README.md && \ + mv new_readme.md README.md + + - name: Commit Updated README + if: success() + run: | + git config --global user.name 'GitHub Actions Bot' + git config --global user.email 'actions@github.com' + git add README.md + git fetch origin proposals + git commit -m "Updated the README file" + git push --force-with-lease origin HEAD:proposals From 9cf7d42a17cdefc5ec158fa598f797397807c581 Mon Sep 17 00:00:00 2001 From: ajlail98 <70709235+ajlail98@users.noreply.github.com> Date: Tue, 8 Oct 2024 14:41:53 -0500 Subject: [PATCH 2/2] deleting old workflows --- .github/workflows/generate_tally.yml | 50 ----------------------- .github/workflows/render_readme.yml | 61 ---------------------------- 2 files changed, 111 deletions(-) delete mode 100644 .github/workflows/generate_tally.yml delete mode 100644 .github/workflows/render_readme.yml diff --git a/.github/workflows/generate_tally.yml b/.github/workflows/generate_tally.yml deleted file mode 100644 index b7d4bca..0000000 --- a/.github/workflows/generate_tally.yml +++ /dev/null @@ -1,50 +0,0 @@ -# .github/workflows/generate_tally.yml - -name: Generate Positivity Tally - -on: - pull_request: - branches: - - main - paths: - - DETECTION_RESULTS.tsv - - assets/positivity_tally.tsv - - .github/workflows/generate_tally.yml - -jobs: - generate-tally: - name: Generate Positivity Tally - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Install Dependencies - run: | - pip install uv - uv venv - source .venv/bin/activate - uv pip install -r requirements.txt - - - name: Tally positive cartons per state - run: | - source .venv/bin/activate - python3 scripts/positivity_tally.py \ - DETECTION_RESULTS.tsv \ - assets/positivity_tally.tsv - - - name: Commit positivity tally - if: success() - run: | - git config --global user.name 'GitHub Actions Bot' - git config --global user.email 'actions@github.com' - git add assets/positivity_tally.tsv - git fetch origin proposals - git commit -m "Updating positivity tally" - git push --force-with-lease origin HEAD:proposals diff --git a/.github/workflows/render_readme.yml b/.github/workflows/render_readme.yml deleted file mode 100644 index a71efbf..0000000 --- a/.github/workflows/render_readme.yml +++ /dev/null @@ -1,61 +0,0 @@ -# .github/workflows/render_readme.yml - -name: Render new README based on tally updates - -on: - pull_request: - branches: - - main - paths: - - assets/positivity_tally.tsv - - .github/workflows/render_readme.yml - - scripts/splice_readme.py - - DETECTION_RESULTS.tsv - -jobs: - render-readme: - name: Render new README - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Install Dependencies - run: | - pip install uv - uv venv - source .venv/bin/activate - uv pip install -r requirements.txt - - - name: Generate Markdown Table - run: | - source .venv/bin/activate - python3 scripts/tsv_to_md.py \ - assets/positivity_tally.tsv \ - > assets/positivity_tally.md - - - name: Splice Table into README - run: | - source .venv/bin/activate - python3 scripts/splice_readme.py - - - name: Replace previous README - run: | - rm README.md && \ - mv new_readme.md README.md - - - name: Commit Updated README - if: success() - run: | - git config --global user.name 'GitHub Actions Bot' - git config --global user.email 'actions@github.com' - git add README.md - git fetch origin proposals - git commit -m "Updated the README file" - git push --force-with-lease origin HEAD:proposals