From 6a29dff45b92d92e4b17ba62338809621afcb7ae Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Wed, 25 Sep 2024 12:46:34 -0500 Subject: [PATCH 1/2] fix: ensure tests run on main --- .github/workflows/test-command.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-command.yml b/.github/workflows/test-command.yml index f8437b9..0cb7a39 100644 --- a/.github/workflows/test-command.yml +++ b/.github/workflows/test-command.yml @@ -30,15 +30,23 @@ jobs: - name: move relock code to current branch run: | + if [[ "${COMMENT_IS_PR}" == "false" ]]; then + branch=pull/${{ github.event.number }}/head + else + branch=main + fi + git checkout main sed -i \ - 's#conda-incubator/relock-conda@main#conda-incubator/relock-conda@pull/${{ github.event.number }}/head#g' \ + "s#conda-incubator/relock-conda@main#conda-incubator/relock-conda@${branch}#g" \ .github/workflows/relock.yml git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add .github/workflows/relock.yml git commit -m "[ci skip] move relock code to current branch for testing" --allow-empty git push + env: + COMMENT_IS_PR: ${{ github.event.issue.pull_request != null }} - name: trigger relock via comment run: | @@ -64,9 +72,14 @@ jobs: - name: cleanup if: always() run: | + if [[ "${COMMENT_IS_PR}" == "false" ]]; then + branch=pull/${{ github.event.number }}/head + else + branch=main + fi git checkout main sed -i \ - 's#conda-incubator/relock-conda@pull/${{ github.event.number }}/head#conda-incubator/relock-conda@main#g' \ + "s#conda-incubator/relock-conda@${branch}#conda-incubator/relock-conda@main#g" \ .github/workflows/relock.yml git add .github/workflows/relock.yml git commit -m "[ci skip] move relock code back to main" @@ -79,4 +92,5 @@ jobs: git push env: GH_TOKEN: ${{ secrets.TEST_PAT }} + COMMENT_IS_PR: ${{ github.event.issue.pull_request != null }} From ca7d4449d5f49733cc3f1794537bd3f5cd86ecf2 Mon Sep 17 00:00:00 2001 From: "Matthew R. Becker" Date: Wed, 25 Sep 2024 12:50:11 -0500 Subject: [PATCH 2/2] doc: add badge to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c0f58ab..0ffff46 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # relock-conda -[![tests](https://github.com/conda-incubator/relock-conda/actions/workflows/tests.yml/badge.svg)](https://github.com/conda-incubator/relock-conda/actions/workflows/tests.yml) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/conda-incubator/relock-conda/main.svg)](https://results.pre-commit.ci/latest/github/conda-incubator/relock-conda/main) +[![tests](https://github.com/conda-incubator/relock-conda/actions/workflows/tests.yml/badge.svg)](https://github.com/conda-incubator/relock-conda/actions/workflows/tests.yml) [![test-command](https://github.com/conda-incubator/relock-conda/actions/workflows/test-command.yml/badge.svg)](https://github.com/conda-incubator/relock-conda/actions/workflows/test-command.yml) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/conda-incubator/relock-conda/main.svg)](https://results.pre-commit.ci/latest/github/conda-incubator/relock-conda/main) GitHub action to relock conda environments using conda-lock