You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When mheap/github-action-required-labels@v1 is used in a multi-step workflow, it won't detect label changes from previous steps, causing the condition of having at least 1 label fail.
Steps to replicate the issue:
Setup files in the repo. release-drafter/release-drafter@v5.15.0 is capable of automatically labeling pull request based on certain criteria, e.g. taking it from the branch prefix, like feature/JIRA-123 -> because of feature prefix, labeling it as enhancement
.github/workflows/pr-label-enforcer.yaml:
on:
pull_request:
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
pr-label-enforcer:
runs-on: ubuntu-latest
steps:
# Only runs for PR 'opened' trigger. Because job steps run in a sequential order, 'check_label' will use the added label
- name: Release Drafter - add label for opened PR
if: github.event.action == 'opened'
uses: release-drafter/release-drafter@v5.15.0
with:
disable-autolabeler: false
disable-releaser: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: sleep 15
if: github.event.action == 'opened'
run: sleep 15
- name: check_label
uses: mheap/github-action-required-labels@v1
with:
mode: minimum
count: 1
labels: "feature, enhancement, fix, bugfix, bug, chore, skip-changelog"
Submit a PR from e.g. feature/JIRA-123 branch. mheap/github-action-required-labels@v1 adds the label enhancement, the second step sleeps for 15 seconds, still, release-drafter/release-drafter@v5.15.0 fails with an error of not finding any labels.
Unfortunately, this causes the workflow to fail on every PR open, because the label checker will fail, and then have to be triggered again manually to pass. The use case of this whole automation would be to enforce labels in all PRs, but also automatically tag PRs when possible.
The text was updated successfully, but these errors were encountered:
Thanks for the report! I've just release v1.2.0 with a fix for this. The issue is that the event.json file is static once the job starts. I've added a check to see if GITHUB_TOKEN is set, and if so it will query the API for live information rather than using the event.json file.
You can continue to use mheap/github-action-required-labels@v1 as the tag has been updated to point to v1.2.0 - all you need to do is provide the GITHUB_TOKEN to use
When mheap/github-action-required-labels@v1 is used in a multi-step workflow, it won't detect label changes from previous steps, causing the condition of having at least 1 label fail.
Steps to replicate the issue:
release-drafter/release-drafter@v5.15.0
is capable of automatically labeling pull request based on certain criteria, e.g. taking it from the branch prefix, likefeature/JIRA-123
-> because of feature prefix, labeling it asenhancement
.github/workflows/pr-label-enforcer.yaml:
.github/release-drafter.yml:
feature/JIRA-123
branch.mheap/github-action-required-labels@v1
adds the labelenhancement
, the second step sleeps for 15 seconds, still,release-drafter/release-drafter@v5.15.0
fails with an error of not finding any labels.Unfortunately, this causes the workflow to fail on every PR open, because the label checker will fail, and then have to be triggered again manually to pass. The use case of this whole automation would be to enforce labels in all PRs, but also automatically tag PRs when possible.
The text was updated successfully, but these errors were encountered: