-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds not stale label on copybara-service[bot] PR's (#4517)
Adds not stale label on copybara-service[bot] PR's. This workflow will not allow stale bot to act on copybara PR's
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This workflow adds not stale label to only copybara[bot] PRs to avoid stale workflow | ||
# | ||
# You can adjust the behavior by modifying this file. | ||
# For more information, see: | ||
# https://github.com/actions-ecosystem/action-add-labels | ||
name: Label Not Stale PRs | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
label-not-stale-prs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check PR author | ||
id: pr-author-check | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const author = context.payload.pull_request.user.login; | ||
return { author: author }; | ||
- name: Add "not stale" label | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
async function run() { | ||
const author = context.payload.pull_request.user.login; | ||
if (author === "copybara-service[bot]") { | ||
const issue_number = context.payload.pull_request.number; | ||
const labels = ["not stale"]; | ||
await github.issues.addLabels({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issue_number, | ||
labels: labels | ||
}); | ||
} | ||
} | ||
run(); |