Skip to content

Add Odd-Even Linked List reordering algorithm (two-pointer approach) #230

Add Odd-Even Linked List reordering algorithm (two-pointer approach)

Add Odd-Even Linked List reordering algorithm (two-pointer approach) #230

Workflow file for this run

name: PR Comment Bot
on:
pull_request_target:
types: [opened, reopened, synchronize, edited]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
pr-bot:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Detect contributor.md change
id: filecheck
run: |
# Get the base and head commits for comparison
BASE_SHA=${{ github.event.pull_request.base.sha }}
HEAD_SHA=${{ github.event.pull_request.head.sha }}
# Fetch the fork's branch
git fetch origin $HEAD_SHA
# Check for contributor.md changes (case insensitive)
if git diff --name-only $BASE_SHA $HEAD_SHA | grep -qi "contributor.md"; then
echo "fileChanged=true" >> $GITHUB_OUTPUT
echo "Found contributor.md changes"
else
echo "fileChanged=false" >> $GITHUB_OUTPUT
echo "No contributor.md changes found"
fi
- name: Run PR bot
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Add this line
script: |
const script = require('./.github/scripts/pr-bot.js');
try {
await script({
github,
context,
fileChanged: '${{ steps.filecheck.outputs.fileChanged }}'
});
} catch (error) {
console.log('PR Bot execution completed with notes:', error.message);
// Don't fail the workflow for comment issues
}