Skip to content

Commit

Permalink
[dash0] fix action to update the .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
basti1302 committed Feb 15, 2024
1 parent 09992e6 commit 815d054
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
37 changes: 30 additions & 7 deletions .github/actions/update-env-file/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ name: Deploy Dash0 OTel Demo
description: deploy a release of the Dash0 fork of the OpenTelemetry demo
inputs:
containerImageVersion:
description: 'version tag of the Dash0 OTel Demo container images, e.g. 1.1.0'
description: "version tag of the Dash0 OTel Demo container images, e.g. 1.1.0"
required: true
token:
description: "token granting read/write access to dash0-configuration repository."
required: true

runs:
Expand All @@ -19,9 +22,29 @@ runs:
shell: bash
run: |
sed -i "s/^IMAGE_VERSION=[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*\.[[:digit:]][[:digit:]]*$/IMAGE_VERSION=${{ inputs.containerImageVersion }}/" .env
git --no-pager diff .env
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .env
git commit -m"[dash0] update image version in .env to ${{ inputs.containerImageVersion }}"
git push
- name: create pull request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
title: update .env file with latest tag
commit-message: '[dash0] update image version in .env to ${{ inputs.containerImageVersion }}'
add-paths: .env
base: main
branch: env-file-update
author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'

- name: auto approve
if: steps.cpr.outputs.pull-request-operation == 'created'
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}

- name: enable pull request auto merge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ inputs.token }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ jobs:
uses: ./.github/actions/update-env-file
with:
containerImageVersion: ${{ github.event.release.tag_name }}
token: ${{ secrets.REPOSITORY_FULL_ACCESS_GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion regenerate-grpc-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ set -euo pipefail
# This script is used to update generated code after changing demo.proto.

cd -P -- "$(dirname -- "$0")"
pwd

command -v npm >/dev/null 2>&1 || {
cat <<EOF >&2
Expand Down

0 comments on commit 815d054

Please sign in to comment.