Skip to content

Commit

Permalink
CI: add dry run workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Mar 27, 2024
1 parent 2219bb5 commit e0085a6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on: [push, pull_request]
on: [ push, pull_request ]

jobs:
ci:
Expand All @@ -26,6 +26,11 @@ jobs:
- name: Run tests
run: cargo test

- name: Dry run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_API_READ_TOKEN }}
run: cargo run -- --only-print-plan github

- name: Build the Docker container
run: docker build -t sync-team .

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/dry_run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Smoke test that checks if we can download team data and read from the GitHub API.
name: Dry run

on:
workflow_dispatch:
schedule:
# Try to dry run every 4 hours
- cron: "0 */4 * * *"

jobs:
run:
name: Perform a dry run
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Dry run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_API_READ_TOKEN }}
run: cargo run -- --only-print-plan github
4 changes: 1 addition & 3 deletions src/github/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,7 @@ fn calculate_permission_diffs(
}
// Bot permissions
let bots = expected_repo.bots.iter().filter_map(|b| {
let Some(bot_name) = bot_name(b) else {
return None;
};
let bot_name = bot_name(b)?;
actual_teams.remove(bot_name);
Some((bot_name, RepoPermission::Write))
});
Expand Down

0 comments on commit e0085a6

Please sign in to comment.