@@ -33,9 +33,8 @@ inputs:
3333 required : false
3434 default : public-github-runners
3535 image :
36- description : Specifies the name of the image that the disk will be initialized with.
36+ description : Specifies the name of the image that the disk will be initialized with. If not provided, will use the latest gh-runner-* image.
3737 required : false
38- default : gh-runner-202508041322
3938 image_family :
4039 description : The image family for the operating system that the boot disk will be initialized with.
4140 required : false
@@ -94,12 +93,30 @@ runs:
9493 shell : bash
9594 run : |
9695 gcloud auth activate-service-account --key-file ${{ steps.auth.outputs.credentials_file_path }}
96+ - name : Get latest runner image
97+ id : get-image
98+ if : github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && inputs.image == ''
99+ shell : bash
100+ run : |
101+ LATEST_IMAGE=$(gcloud compute images list \
102+ --project=${{ inputs.image_project }} \
103+ --filter="name~'gh-runner-.*'" \
104+ --sort-by="~creationTimestamp" \
105+ --format="value(name)" \
106+ --limit=1)
107+ echo "image=${LATEST_IMAGE}" >> $GITHUB_OUTPUT
108+ echo "Using latest image: ${LATEST_IMAGE}"
97109 - name : Create GCE VM
98110 id : gce-github-runner-script
99111 if : github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
100112 shell : bash
101113 run : |
102114 set -x
115+
116+ IMAGE_TO_USE="${{ inputs.image }}"
117+ if [ -z "${IMAGE_TO_USE}" ]; then
118+ IMAGE_TO_USE="${{ steps.get-image.outputs.image }}"
119+ fi
103120
104121 ${{ github.action_path }}/action.sh \
105122 --command=start \
@@ -111,7 +128,7 @@ runs:
111128 --scopes=${{ inputs.scopes }} \
112129 --shutdown_timeout=${{ inputs.shutdown_timeout }} \
113130 --image_project=${{ inputs.image_project }} \
114- --image=${{ inputs.image }} \
131+ --image="${IMAGE_TO_USE}" \
115132 --image_family=${{ inputs.image_family }} \
116133 --label=${{ inputs.label }} \
117134 --boot_disk_type=pd-ssd \
0 commit comments