Skip to content

Commit

Permalink
Fix autoupdate PR message (#41)
Browse files Browse the repository at this point in the history
* Fix PR message

* Tweaks

* Update create-pull-request version

* Reorder
  • Loading branch information
maresb authored Jun 13, 2024
1 parent 294c05a commit fe4d19d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/update-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ jobs:
python -m pip install --quiet --disable-pip-version-check -r scripts/update_base_image_reqs.txt
python scripts/update_base_image.py
- name: Create PR
uses: peter-evans/create-pull-request@ee93d78b55ada32aa74b5e9957aac9c2523dd22c
uses: peter-evans/create-pull-request@v6.0.5
with:
branch: "update-base-image"
commit-message: "Update to micromamba base image to ${{ steps.update_dockerfile.outputs.new_docker_tag }}"
title: "Update to micromamba base image to ${{ steps.update_dockerfile.outputs.new_docker_tag }}"
commit-message: "Update to micromamba base image to ${{ env.NEW_DOCKER_TAG }}"
title: "Update to micromamba base image to ${{ env.NEW_DOCKER_TAG }}"
body: "Generated by [update-base-image.yml](https://github.com/mamba-org/micromamba-devcontainer/actions/runs/${{ github.run_id }}/workflow)"
delete-branch: true
reviewers: maresb
13 changes: 5 additions & 8 deletions scripts/update_base_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
REGISTRY_QUERY_URL = (
"https://hub.docker.com/v2/repositories/mambaorg/micromamba/tags?page_size=200"
)
GITHUB_OUTPUT = (
Path(os.environ["GITHUB_OUTPUT"]) if "GITHUB_OUTPUT" in os.environ else None
)
GITHUB_ENV = Path(os.environ["GITHUB_ENV"]) if "GITHUB_ENV" in os.environ else None


class DockerImageTag(NamedTuple):
Expand Down Expand Up @@ -135,11 +133,10 @@ def main():
if updated_image_tag == current_image_tag:
print("No update needed for Dockerfile.")
else:
new_docker_tag = update_dockerfile(
lines,
line_number,
updated_image_tag,
)
new_docker_tag = update_dockerfile(lines, line_number, updated_image_tag)
if GITHUB_ENV:
with open(GITHUB_ENV, "a") as f:
f.write(f"NEW_DOCKER_TAG={new_docker_tag}\n")
print(f"✅ Update successful: {new_docker_tag}")

print("Updating workflow file...")
Expand Down

0 comments on commit fe4d19d

Please sign in to comment.