Skip to content

[don't merge yet] Update Style action #3123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 14 additions & 3 deletions .github/workflows/style-bot-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,14 @@ on:
bot_token:
required: true
description: "GitHub token with permissions to comment and push to PR"

outputs:
new_commit_sha:
description: "The new commit sha if any"
value: ${{ jobs.run-style-bot.outputs.new_commit_sha }}
pr_number:
description: "The PR number"
value: ${{ jobs.run-style-bot.outputs.pr_number }}

jobs:
check-permissions:
if: >
Expand Down Expand Up @@ -60,6 +67,9 @@ jobs:
needs: check-permissions
if: needs.check-permissions.outputs.is_authorized == 'true'
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.pr_info.outputs.prNumber }}
new_commit_sha: ${{ steps.commit_and_push.outputs.new_commit_sha }}
steps:
- name: Extract PR details
id: pr_info
Expand Down Expand Up @@ -90,7 +100,7 @@ jobs:

- name: Check out PR branch
uses: actions/checkout@v3
env:
env:
HEADREPOFULLNAME: ${{ steps.pr_info.outputs.headRepoFullName }}
HEADREF: ${{ steps.pr_info.outputs.headRef }}
with:
Expand Down Expand Up @@ -169,7 +179,7 @@ jobs:

- name: Commit and push changes
id: commit_and_push
env:
env:
HEADREPOFULLNAME: ${{ steps.pr_info.outputs.headRepoFullName }}
HEADREF: ${{ steps.pr_info.outputs.headRef }}
PRNUMBER: ${{ steps.pr_info.outputs.prNumber }}
Expand All @@ -187,6 +197,7 @@ jobs:
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Apply style fixes"
echo "new_commit_sha=$(git log -n 1 --format=format:%H)" >> $GITHUB_OUTPUT
# Push to the original contributor's forked branch
git push origin HEAD:$HEADREF
echo "changes_pushed=true" >> $GITHUB_OUTPUT
Expand Down