Skip to content

Commit

Permalink
rename list again
Browse files Browse the repository at this point in the history
  • Loading branch information
aracho1 committed May 31, 2024
1 parent bf4398d commit b2c2a05
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This action automatically sends a message to google chats detailing the list of

**Required** PR labels to ignore when scanning for PR's. Defaults to `Stale`

## `github-alert-users`
## `github-announced-users`

**Optional** Github users to announce PR's from. If set, other users' PR's will be ignored. Defaults to none.

Expand Down Expand Up @@ -54,7 +54,7 @@ export GITHUB_IGNORED_USERS=49699333
export GITHUB_IGNORED_LABELS=dependencies
# List of users to announce PR's from (if set, other users will be ignored)
# (e.g. 49699333 is dependabot)
export GITHUB_ALERT_USERS=49699333
export GITHUB_ANNOUNCED_USERS=49699333

cargo run
```
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ inputs:
description: "Comma delimited list of user ID's to ignore"
required: true
default: "49699333"
github-alert-users:
description: "Comma delimited list of user ID's to show"
github-announced-users:
description: "Comma delimited list of user ID's to announce"
required: false
default: ""
github-ignored-labels:
Expand All @@ -36,7 +36,7 @@ runs:
GITHUB_REPOSITORIES: ${{ inputs.github-repositories }}
GITHUB_TOKEN: ${{ inputs.github-token }}
GITHUB_IGNORED_USERS: ${{ inputs.github-ignored-users }}
GITHUB_ALERT_USERS: ${{ inputs.github-alert-users }}
GITHUB_ANNOUNCED_USERS: ${{ inputs.github-announced-users }}
GITHUB_IGNORED_LABELS: ${{ inputs.github-ignored-labels }}
GOOGLE_WEBHOOK_URL: ${{ inputs.google-webhook-url }}
SHOW_PR_AGE: ${{ inputs.show-pr-age }}
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn scan_repository(
repository_name: String,
github_token: &String,
ignored_users: &Vec<&str>,
alert_users: &Vec<&str>,
announced_users: &Vec<&str>,
ignored_labels: &Vec<&str>,
) -> Result<Vec<GithubPullRequest>, Error> {
info!("Starting PR scan of {}", repository_name);
Expand Down Expand Up @@ -52,10 +52,10 @@ async fn scan_repository(
continue;
}

if !alert_users.contains(&pull_request.user().id().to_string().as_str()) {
info!("Users to alert: {:?}", alert_users);
if !announced_users.contains(&pull_request.user().id().to_string().as_str()) {
info!("Users to announce: {:?}", announced_users);
info!(
"Ignoring PR {}({}) as it was raised by a user not included in the alert users list {}({})",
"Ignoring PR {}({}) as it was raised by a user not included in the announced users list {}({})",
pull_request.id(),
pull_request.title(),
pull_request.user().id(),
Expand Down Expand Up @@ -126,8 +126,8 @@ async fn main() -> Result<(), Error> {
env::var("GOOGLE_WEBHOOK_URL").context("GOOGLE_WEBHOOK_URL must be set")?;
let ignored_users: String = env::var("GITHUB_IGNORED_USERS").unwrap_or("".to_string());
let ignored_users: Vec<&str> = ignored_users.split(",").collect();
let alert_users: String = env::var("GITHUB_ALERT_USERS").unwrap_or("".to_string());
let alert_users: Vec<&str> = alert_users.split(",").collect();
let announced_users: String = env::var("GITHUB_ANNOUNCED_USERS").unwrap_or("".to_string());
let announced_users: Vec<&str> = announced_users.split(",").collect();
let ignored_labels: String = env::var("GITHUB_IGNORED_LABELS").unwrap_or("".to_string());
let ignored_labels: Vec<&str> = ignored_labels.split(",").collect();
let show_pr_age: bool = env::var("SHOW_PR_AGE")
Expand All @@ -142,7 +142,7 @@ async fn main() -> Result<(), Error> {
repository.to_string(),
&github_token,
&ignored_users,
&alert_users,
&announced_users,
&ignored_labels,
)
.await?,
Expand Down

0 comments on commit b2c2a05

Please sign in to comment.