Skip to content

Commit ba215d0

Browse files
committed
Add permissions and fetch for PR validation
Update GitHub Actions workflow to include `issues: write` and `pull-requests: write` permissions, and fetch the base branch before comparing changes for more accurate dataset validation.
1 parent cfb37f7 commit ba215d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

.github/workflows/validate-datasets.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
permissions:
2020
contents: read
21+
issues: write
2122
pull-requests: write
2223

2324
steps:
@@ -41,6 +42,7 @@ jobs:
4142
run: |
4243
if [ "${{ github.event_name }}" = "pull_request" ]; then
4344
# For PRs, compare against the base branch
45+
git fetch origin "${{ github.base_ref }}" --depth=1
4446
git diff --name-only origin/${{ github.base_ref }}...HEAD | grep "^datasets/" | cut -d'/' -f1-2 | sort -u > changed_datasets.txt
4547
else
4648
# For pushes to master, check the last commit
@@ -127,7 +129,7 @@ jobs:
127129
console.log('Could not create comment:', error.message)
128130
console.log('This is likely due to permissions. The validation still failed - check the Actions tab for details.')
129131
}
130-
132+
131133
- name: Comment on PR success
132134
if: success() && github.event_name == 'pull_request' && steps.changed-datasets.outputs.has_changes == 'true'
133135
uses: actions/github-script@v7

0 commit comments

Comments
 (0)