Skip to content

Commit d2266a5

Browse files
authored
Merge bf4f5e1 into 7b2c180
2 parents 7b2c180 + bf4f5e1 commit d2266a5

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/prettier.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Prettier
33
on:
44
pull_request:
55
paths:
6-
- 'src/**/*.{js,jsx,ts,tsx}'
6+
- 'src/**/*.js'
77
- '.github/workflows/prettier.yml'
88
types:
99
- opened
@@ -38,7 +38,9 @@ jobs:
3838
echo "Fixing the following files:"
3939
echo "$CHANGED_FILES"
4040
echo "$CHANGED_FILES" | xargs npx prettier --write
41-
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
41+
# Join the filenames into a single line with space separation
42+
JOINED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
43+
echo "CHANGED_FILES=$JOINED_FILES" >> $GITHUB_ENV
4244
else
4345
echo "No files to format"
4446
fi
@@ -52,7 +54,10 @@ jobs:
5254
git config user.email "[email protected]"
5355
git add .
5456
git commit -m "Apply Prettier formatting"
55-
git push
57+
58+
# Push the commit to the branch
59+
git push origin HEAD:$GITHUB_HEAD_REF
60+
5661
DIFF_OUTPUT=$(git diff HEAD~1 HEAD)
5762
echo "DIFF_OUTPUT<<EOF" >> $GITHUB_ENV
5863
echo "$DIFF_OUTPUT" >> $GITHUB_ENV
@@ -65,7 +70,8 @@ jobs:
6570
GH_TOKEN: ${{ github.token }}
6671
run: |
6772
if [ -n "${{ env.DIFF_OUTPUT }}" ]; then
68-
gh pr comment ${{ github.event.pull_request.number }} --body "$(echo -e "Hi from your friendly robot! 🤖\n\nI've applied Prettier formatting to the following files:\n\n${{ env.CHANGED_FILES }}\n\nThe full diff is below:\n\n<details>\n<summary>Click to expand</summary>\n\n\`\`\`diff\n$DIFF_OUTPUT\n\`\`\`\n</details>")"
73+
CURRENT_COMMIT=$(git rev-parse --short HEAD)
74+
gh pr comment ${{ github.event.pull_request.number }} --body "$(echo -e "Hi from your friendly robot! 🤖\n\nI've applied Prettier formatting to the following files in $CURRENT_COMMIT:\n\n\`${{ env.CHANGED_FILES }}\`\n\nThe full diff is below. Please review the changes.\n\n<details>\n<summary>Click to expand</summary>\n\n\`\`\`diff\n$DIFF_OUTPUT\n\`\`\`\n</details>")"
6975
else
7076
echo "No Prettier changes"
7177
fi

src/components/callout.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,4 @@ const Callout = ({ type, children, title, link }) => {
1111
</div>
1212
)
1313
}
14-
15-
export default Callout
14+
export default Callout

0 commit comments

Comments
 (0)