Sync not working on labels with exceptions
Description:
Sync doesn't seem to work for the directories which a label has exceptions in (partially. It removed one label). Maybe my file is setup wrong but some labels remain after there are no changes to a PR.
The remaining labels in the screenshot are code and icons.
Maybe I'm testing it too extremely? Or it's just setup incorrectly
Action version: 5.0.0
Platform:
- [ ] Ubuntu
- [x] macOS
- [ ] Windows
Runner type:
- [ ] Hosted
- [ ] Self-hosted
Repro steps:
Testing on a private test repo but here is the public repo if it helps.
name: "Label PRs"
on:
- pull_request_target
jobs:
label-prs:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v5
with:
sync-labels: true
docs:
- changed-files:
- any-glob-to-any-file: '*.md'
- any-glob-to-any-file: .github/PULL_REQUEST_TEMPLATE/*.md
- any-glob-to-any-file: .github/pull_request_template.md
- any-glob-to-any-file: docs/**
icons:
- changed-files:
- any-glob-to-any-file: svgs/*
- any-glob-to-any-file: app/assets/appfilter.xml
code:
- all:
- changed-files: # Not indented as it either had the same or better results
- any-glob-to-any-file: 'app/**'
- any-glob-to-all-files: '!app/src/main/res/*/strings.xml'
- any-glob-to-all-files: '!app/assets/appfilter.xml'
locale:
- changed-files:
- any-glob-to-any-file: app/src/main/res/*/strings.xml
Expected behavior: Each label will be removed after all changes have been removed.
Actual behavior:
Labels remain even after the PR has no changed files (only code, icons and/or locale
Hello @Chefski! Thank you for reporting this! We will take a look and contact you as soon as we have any updates!
So what I think is happening is that action/labeler@v5 is seeing a stale copy from a different branch. I'm trying to update the .github/labeler.yml on the dependabot PR that updates the action to v5 and that's where I was seeing this issue. But looking at the failing jobs, they doing The configuration file (path: .github/labeler.yml) was found locally, reading from the file. We use self-hosted runners where a different workflow could definitely checkout to run tests or whatnot. These checkouts stick around and rely on action/checkout to force it to be at the correct ref. What I'm hypothesizing is that actions/labeler@v5 is seeing the older checkout.
For right now, I'm going to add a actions/checkout@v4 step before the labeler to ensure that it's getting the labeler.yml from the correct branch.
@lamdor i was trying to repo as well in a non-private repo and had same thought - in our private repo, that would match what we see. To fix, we need a format that works in both v4 and v5 lest every branch needs to update at once, which is nearly impossible for companies. - or else it needs to read just from the appropriate branch it's running from