Skip to content

Commit

Permalink
refactor: Update devcontainer image name construction in build-devcon…
Browse files Browse the repository at this point in the history
…tainer.yml and test-devcontainer.yml
  • Loading branch information
lgersman committed Oct 10, 2024
1 parent 3d7fdc1 commit 3545243
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/shared/devcontainer-image-name/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ runs:
- name: build image name
shell: bash
run: |
# construct IMAGE_NAME from repo owner/name and branch
# construct image_name from repo owner/name and branch
# example value : "ghcr.io/IONOS-Wordpress/ionos-wordpress-develop-devcontainer"
IMAGE_NAME="ghcr.io/${GITHUB_REPOSITORY}-${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}-devcontainer"
# convert imagename to lowercase and provide it as step variable "image_name"
echo "::set-output name=image_name::${IMAGE_NAME@L}"
image_name="ghcr.io/${GITHUB_REPOSITORY}-${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}-devcontainer"
# convert image_name to lowercase and provide it as step variable "image_name"
echo "image_name=${image_name@L}" >> $GITHUB_OUTPUT
8 changes: 8 additions & 0 deletions .github/workflows/build-devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ on:
# only rebuild devcontainer image if files in ./github/** are changed
paths:
- '.github/**'
# make this workflow reusable from other workflows
workflow_call:
branches:
- main
- develop
# only rebuild devcontainer image if files in ./github/** are changed
paths:
- '.github/**'

permissions:
# write-all is too much, but we need to write to packages
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
default: 'echo "WP_ENV_HOME=${WP_ENV_HOME} !"'

jobs:
build-devcontainer-image-if-outdated:
uses: ./.github/workflows/build-devcontainer.yml

test:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit 3545243

Please sign in to comment.