diff options
author | Gina Häußge <gina@octoprint.org> | 2021-10-27 13:57:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-27 13:57:01 +0300 |
commit | 450d5bb9aef92c25a1722f9b9a053b594c8b5b5e (patch) | |
tree | 6ca4bbad8e806b74628b08d6b1b041e1f85b3703 /.github | |
parent | 5444c46777643c133d529ae35c050585904ddfe0 (diff) |
👷♂️ Fix PR automation
Labels weren't refreshed properly in a step, causing
labeling to be reverted and thereby causing issues
in a later step.
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/pr_automation.yml | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml index c1f115ecf..2d3ae592b 100644 --- a/.github/workflows/pr_automation.yml +++ b/.github/workflows/pr_automation.yml @@ -12,13 +12,18 @@ jobs: with: repo-token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/github-script@v2 + - uses: actions/github-script@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - let labels = []; + # fetch a fresh set of labels, they might have changed earlier + const issueLabels = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number + }); + let labels = issueLabels.data.map(label => label.name); let setLabels = false; - context.payload.pull_request.labels.forEach(label => { labels.push(label.name) }); let target = context.payload.pull_request.base.ref; if (["maintenance", "devel", "staging/maintenance", "staging/devel", "master"].includes(target)) { @@ -27,7 +32,7 @@ jobs: } if (setLabels) { - github.issues.setLabels({ + github.rest.issues.setLabels({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, |