Skip to content

Commit

Permalink
The workflow runs from the main repo and fixed bug in size labeler
Browse files Browse the repository at this point in the history
  • Loading branch information
amanmoon committed May 30, 2024
1 parent 77323e2 commit 2906bf9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env bash

echo 'set_labels_by_changes.sh called with environment:'
cd $PR_MOUNT_DIR
PR_BASE_SHA=$(git merge-base $BASE_SHA $PR_HEAD_SHA)

echo "set_labels_by_changes.sh called with environment:"
echo "BASE SHA: $PR_BASE_SHA"
echo "HEAD SHA: $PR_HEAD_SHA"
echo "SMALL THRESHOLD $SMALL_THRESHOLD"
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,32 @@ jobs:
permissions:
pull-requests: write
steps:
- name: Checkout code
- name: Checkout the main repo
uses: actions/checkout@v4
with:
sparse-checkout: |
.ci
- name: Checkout the pull request repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
path: ${{ github.event.pull_request.head.repo.name }}

- name: Add labels based on size
run: |
git fetch origin $BASE_SHA
chmod a+x .github/workflows/set_labels_by_changes.sh
.github/workflows/set_labels_by_changes.sh
git fetch origin $BASE_REF
chmod a+x .ci/set_labels_by_changes.sh
.ci/set_labels_by_changes.sh
env:
BASE_SHA: ${{ github.base_ref }}
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
BASE_REF: ${{ github.base_ref }}
PR_MOUNT_DIR: ${{ github.event.pull_request.head.repo.name }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPOSITORY: ${{ github.repository }}
PR_REPO: ${{ github.event.pull_request.head.repo.name }}
PR_NUMBER: ${{ github.event.pull_request.number}}
SMALL_THRESHOLD: ${{ vars.SMALL_THRESHOLD }}
MODERATE_THRESHOLD: ${{ vars.MODERATE_THRESHOLD }}
Expand Down

0 comments on commit 2906bf9

Please sign in to comment.