👷‍♂️ Fix PR automation

Labels weren't refreshed properly in a step, causing
labeling to be reverted and thereby causing issues 
in a later step.
This commit is contained in:
Gina Häußge authored and GitHub committed 2021-10-27 12:57:01 +02:00
1 parent 5444c46777
commit 450d5bb9ae
1 file changed
+9 -4
+9 -4
View File
@@ -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,