Skip to content

Commit

Permalink
Adds not stale label on copybara-service[bot] PR's (#4517)
Browse files Browse the repository at this point in the history
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
sgowroji authored Mar 1, 2023
1 parent 9a942dc commit bbbc838
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/notstale.yml
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();

0 comments on commit bbbc838

Please sign in to comment.