Skip to content

Commit

Permalink
Unlock PR before commenting in backport action (#11639)
Browse files Browse the repository at this point in the history
Otherwise commenting would fail. We lock the PR again after the action is done.
  • Loading branch information
akoeplinger authored Nov 16, 2022
1 parent d2adb82 commit ef2b50f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/backport-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,17 @@ jobs:
if (target_branch == null) throw "Error: No backport branch found in the trigger phrase.";
return target_branch[1];
- name: Unlock comments if PR is locked
uses: actions/github-script@v6
if: ${{ github.event.issue.locked == true }}
with:
script: |
console.log(`Unlocking locked PR #${context.issue.number}.`);
await github.rest.issues.unlock({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
});
- name: Post backport started comment to pull request
uses: actions/github-script@v6
with:
Expand Down Expand Up @@ -229,3 +240,15 @@ jobs:
});
}
- name: Re-lock PR comments
uses: actions/github-script@v6
if: ${{ github.event.issue.locked == true && (success() || failure()) }}
with:
script: |
console.log(`Locking previously locked PR #${context.issue.number} again.`);
await github.rest.issues.lock({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
lock_reason: "resolved"
});

0 comments on commit ef2b50f

Please sign in to comment.