Skip to content

Commit 2a6484a

Browse files
authored
Post a link to a created PR on Slack when versions file is updated (#4554)
Also, use the new / non-depricated approach to outputs.
1 parent 55de837 commit 2a6484a

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.github/workflows/bump-agent-versions.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ else
2222

2323
git commit -m "[$GITHUB_REF_NAME][Automation] Update .agent-versions.json" -m "$commit_desc"
2424
git push --set-upstream origin "update-agent-versions-$GITHUB_RUN_ID"
25-
gh pr create \
25+
pr=$(gh pr create \
2626
--base "$GITHUB_REF_NAME" \
2727
--fill-first \
2828
--head "update-agent-versions-$GITHUB_RUN_ID" \
2929
--label 'Team:Elastic-Agent' \
3030
--label 'update-versions' \
3131
--label 'skip-changelog' \
3232
--label 'backport-skip' \
33-
--repo $GITHUB_REPOSITORY
34-
echo "::set-output name=pr::true" # set step output for notifications
33+
--repo $GITHUB_REPOSITORY)
34+
echo "pr=$pr" >> $GITHUB_OUTPUT # set the step output for Slack notifications
3535
fi

.github/workflows/bump-agent-versions.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ jobs:
5454
message: ":traffic_cone: Elastic Agent versions file update failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
5555
channel: "#ingest-notifications"
5656

57-
- if: ${{ success() && steps.update.output.pr == true}}
57+
# if a PR was created as a result of this job, we notify on the Slack channel
58+
- if: ${{ startsWith(steps.update.output.pr, 'https') }}
5859
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
5960
with:
6061
url: ${{ secrets.VAULT_ADDR }}
6162
roleId: ${{ secrets.VAULT_ROLE_ID }}
6263
secretId: ${{ secrets.VAULT_SECRET_ID }}
63-
message: "Update for Elastic Agent versions file has been created https://github.com/elastic/elastic-agent/pulls?q=is%3Aopen+is%3Apr+label%3Aupdate-versions"
64+
message: "Update for Elastic Agent versions file has been created: ${{ steps.update.output.pr }}"
6465
channel: "#ingest-notifications"

0 commit comments

Comments
 (0)