Fix auto-update action (#7804)

so it doesn't keep trying to open new PRs while existing PR is open
This commit is contained in:
Trask Stalnaker 2023-02-11 12:38:40 -08:00 committed by GitHub
parent 8e8161cb2e
commit ee722f9a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -12,6 +12,7 @@ jobs:
outputs:
current-version: ${{ steps.check-versions.outputs.current-version }}
latest-version: ${{ steps.check-versions.outputs.latest-version }}
already-opened: ${{ steps.check-versions.outputs.already-opened }}
steps:
- uses: actions/checkout@v3
@ -28,12 +29,24 @@ jobs:
--jq .tagName \
| sed 's/^v//')
matches=$(gh pr list \
--author opentelemetrybot \
--state open \
--search "in:title \"Update the OpenTelemetry SDK version to $latest_version\"")
if [ ! -z "$matches" ]
then
already_opened=true
fi
echo "current-version=$current_version" >> $GITHUB_OUTPUT
echo "latest-version=$latest_version" >> $GITHUB_OUTPUT
echo "already-opened=$already_opened" >> $GITHUB_OUTPUT
update-otel-sdk:
runs-on: ubuntu-latest
if: needs.check-versions.outputs.current-version != needs.check-versions.outputs.latest-version
if: |
needs.check-versions.outputs.current-version != needs.check-versions.outputs.latest-version &&
needs.check-versions.outputs.already-opened != 'true'
needs:
- check-versions
steps:
@ -56,7 +69,7 @@ jobs:
env:
VERSION: ${{ needs.check-versions.outputs.latest-version }}
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
run: |
message="Update the OpenTelemetry SDK version to $VERSION"
body="Update the OpenTelemetry SDK version to \`$VERSION\`."