Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions .github/workflows/auto-update-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,10 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: steps.unzip-patch.outputs.exists == 'true'
with:
repository: "${{ github.event.workflow_run.head_repository.full_name }}"
ref: "${{ github.event.workflow_run.head_branch }}"
token: ${{ steps.otelbot-token.outputs.token }}

- id: get-pr
if: steps.unzip-patch.outputs.exists == 'true'
name: Get PR
env:
PR_BRANCH: |-
${{
(github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login)
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
|| github.event.workflow_run.head_branch
}}
GH_TOKEN: ${{ github.token }}
run: |
echo gh pr view "${PR_BRANCH}" --json number --jq .number
number=$(gh pr view "${PR_BRANCH}" --json number --jq .number)
echo $number
echo "number=$number" >> $GITHUB_OUTPUT

- name: Check out PR branch
if: steps.unzip-patch.outputs.exists == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: gh pr checkout ${{ steps.get-pr.outputs.number }}

- name: Use CLA approved github bot
if: steps.unzip-patch.outputs.exists == 'true'
# IMPORTANT do not call the .github/scripts/use-cla-approved-bot.sh
Expand All @@ -83,14 +62,34 @@ jobs:
git commit -a -m "./gradlew spotlessApply"
git push

- id: get-pr
if: steps.unzip-patch.outputs.exists == 'true'
name: Get PR
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
PR_BRANCH: |-
${{
(github.event.workflow_run.head_repository.owner.login != github.event.workflow_run.repository.owner.login)
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch)
|| github.event.workflow_run.head_branch
}}
run: |
number=$(gh pr view "$PR_BRANCH" --json number --jq .number)
echo "number=$number" >> $GITHUB_OUTPUT

- if: steps.unzip-patch.outputs.exists == 'true' && success()
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
PR_NUMBER: ${{ steps.get-pr.outputs.number }}
run: |
gh pr comment ${{ steps.get-pr.outputs.number }} --body "🔧 The result from spotlessApply was committed to the PR branch."
gh pr comment $PR_NUMBER --body "🔧 The result from spotlessApply was committed to the PR branch."

- if: steps.unzip-patch.outputs.exists == 'true' && failure()
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
PR_NUMBER: ${{ steps.get-pr.outputs.number }}
run: |
gh pr comment ${{ steps.get-pr.outputs.number }} --body "❌ The result from spotlessApply could not be committed to the PR branch, see logs: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID."
gh pr comment $PR_NUMBER --body "❌ The result from spotlessApply could not be committed to the PR branch, see logs: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID."
42 changes: 42 additions & 0 deletions .github/workflows/create-dummy-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create a dummy PR
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


on:
workflow_dispatch:

permissions:
contents: read

jobs:
create:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Need to make some kind of change, and this workflow will no longer be needed after running it the one time, so...
run: git rm .github/workflows/create-dummy-pr.yml

- name: Use CLA approved bot
run: .github/scripts/use-cla-approved-bot.sh

- uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: otelbot-token
with:
app-id: 1295839
private-key: ${{ secrets.OTELBOT_JAVA_INSTRUMENTATION_PRIVATE_KEY }}

- name: Create pull request against the release branch
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
run: |
message="A dummy PR to give otelbot-java-instrumentation one merged PR under its belt"
branch="otelbot/dummy-pr"

git checkout -b $branch
git commit -a -m "$message"
git push --set-upstream origin $branch
gh pr create --title "$message" \
--body "$message." \
--base main
Loading