-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1932096 - Create a GitHub action cron job to periodiaclly update …
…in-tree data dumps We want to keep the in-tree remote-settings dumps up to date. For this, a GitHub Actions workflow seems to be the easiest way for now. The workflow will check once a week if there is new data (through the `cargo remote-settings dump-sync` command). And commit any changes to a new branch and open a PR against main.
- Loading branch information
Showing
1 changed file
with
58 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,58 @@ | ||
name: Update Remote Settings Dumps | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * 0" # Run weekly on Sunday at midnight | ||
workflow_dispatch: # Allow manual trigger | ||
|
||
jobs: | ||
update-dumps: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
fetch-depth: 0 | ||
submodules: recursive | ||
|
||
- name: Set up repository and install Rust | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
source $HOME/.cargo/env | ||
- name: Create new branch and run dump | ||
run: | | ||
# Configure git | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "Bastian Gruber" | ||
# Create new branch | ||
BRANCH_NAME="update-remote-settings-dumps-$(date +%Y%m%d)" | ||
git checkout -b $BRANCH_NAME | ||
# Run the dump command | ||
cargo remote-settings dump-sync | ||
# Check for changes and create PR if needed | ||
git add ./components/remote_settings/dumps/ | ||
if git status --porcelain -- ./components/remote_settings/dumps/ | grep .; then | ||
git commit -m "chore: Update remote settings dumps" | ||
git push origin $BRANCH_NAME | ||
# Create the PR (gh is installed on GH Actions) | ||
gh pr create \ | ||
--title "Update Remote Settings Dumps" \ | ||
--body "Automated PR to update remote settings dumps. | ||
Changes detected in: \`./components/remote_settings/dumps/\` | ||
Generated by the Update Remote Settings Dumps workflow." \ | ||
--base main \ | ||
--head $BRANCH_NAME | ||
else | ||
echo "No changes detected in dumps directory" | ||
fi |