Skip to content

Commit

Permalink
espn automation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Oct 9, 2024
1 parent d6ea719 commit 09f6933
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/update_players.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
fail-fast: false
matrix:
season: ${{ fromJson(needs.update_setup.outputs.seasons) }}
type: ["roster", "raw_draft", "raw_pff"]
type: ["roster", "raw_draft", "raw_pff", "raw_espn"]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.NFLVERSE_GH_TOKEN }}
Expand All @@ -83,7 +83,7 @@ jobs:
strategy:
fail-fast: false
matrix:
type: ["basis", "pfr", "otc", "pff", "draft"]
type: ["basis", "pfr", "otc", "pff", "draft", "espn"]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.NFLVERSE_GH_TOKEN }}
Expand Down
8 changes: 7 additions & 1 deletion build/00_update_season_data.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
season <- Sys.getenv("NFLVERSE_UPDATE_SEASON", unset = NA_character_) |> as.integer()

type <- Sys.getenv("NFLVERSE_UPDATE_TYPE", unset = NA_character_)
type <- rlang::arg_match0(type, c("roster", "raw_draft", "raw_pff"))
type <- rlang::arg_match0(type, c("roster", "raw_draft", "raw_pff", "raw_espn"))

if (type == "roster"){
out <- nflverse.players::.basis_release_raw_roster(seasons = season)
Expand All @@ -14,4 +14,10 @@ if (type == "roster"){
}
} else if (type == "raw_pff" && nflverse.players:::.pff_is_valid_season(season)){
out <- nflverse.players::.pff_release_raw_players(seasons = season)
} else if (type == "raw_espn" && nflverse.players:::.espn_is_valid_season(season)){
out <- nflverse.players::.espn_release_raw_players(seasons = season)
# The next step downloads above data. Let's give the server some time to
# process it
Sys.sleep(45)
combined <- nflverse.players::.espn_combine_raw_players()
}
4 changes: 3 additions & 1 deletion build/01_update_components.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type <- Sys.getenv("NFLVERSE_UPDATE_TYPE", unset = NA_character_)
type <- rlang::arg_match0(type, c("basis", "pfr", "otc", "draft", "pff"))
type <- rlang::arg_match0(type, c("basis", "pfr", "otc", "draft", "pff", "espn"))

if (type == "basis"){
out <- nflverse.players::players_basis_release()
Expand All @@ -13,4 +13,6 @@ if (type == "basis"){
out <- nflverse.players::players_draft_release()
} else if (type == "pff"){
out <- nflverse.players::players_pff_release()
} else if (type == "espn"){
out <- nflverse.players::players_espn_release()
}

0 comments on commit 09f6933

Please sign in to comment.