-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add workflow to update the aggregator (#3738)
# Motivation We need to render SNS data accurately, so need to keep the aggregator SNS bindings up to date. # Changes - Add a bot to update the SNS aggregator bindings regularly. - Note: If the candid API has not changed, no new PR will be created. - Note: The code is largely identical to the bot that updates the proposals bindings and generally matches all the other update bots. # Tests - The one test run showed a breaking change that needed manual intervention. The run correctly posted the error in slack and I have made a PR with the manual changes. - Run again and it correctly declared that no changes are needed: https://github.com/dfinity/nns-dapp/actions/runs/6863398505/job/18663096004 # Todos - [x] Add entry to changelog (if necessary).
- Loading branch information
Showing
2 changed files
with
71 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,70 @@ | ||
# A GitHub Actions workflow that regularly updates the aggregator SNS parsing code | ||
# and creates a PR for any changes. | ||
name: Update aggregator candid bindings | ||
on: | ||
schedule: | ||
- cron: '30 3 * * *' | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
# Run when the development branch for this workflow is updated. | ||
- update-aggregator | ||
jobs: | ||
update-aggregator: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install didc | ||
run: | | ||
USER_BIN="$HOME/.local/bin" | ||
mkdir -p "$USER_BIN" | ||
echo "$USER_BIN" >> $GITHUB_PATH | ||
version="$(jq -r .defaults.build.config.DIDC_VERSION dfx.json)" | ||
# TODO: Make `didc` support `binstall`, then use `binstall` here. | ||
curl -Lf "https://github.com/dfinity/candid/releases/download/${version}/didc-linux64" | install -m 755 /dev/stdin "$USER_BIN/didc" | ||
- name: Update to the latest declared APIs | ||
id: update | ||
run: scripts/mk_nns_types.sh | ||
- name: Create Pull Request | ||
id: cpr | ||
# Note: If there were no changes, this step creates no PR. | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GIX_BOT_PAT }} | ||
commit-message: Update aggregator | ||
committer: GitHub <noreply@github.com> | ||
author: gix-bot <gix-bot@users.noreply.github.com> | ||
base: main | ||
# Note: Please be careful when updating the add-paths field. We have had the snsdemo committed by accident, with a pattern that matches nothing seemingly committing everything. | ||
add-paths: rs/sns_aggregator/src/types/* | ||
branch: bot-aggregator-update | ||
branch-suffix: timestamp | ||
delete-branch: true | ||
title: 'Update aggregator' | ||
body: | | ||
# Motivation | ||
We would like to parse all the latest SNS data. | ||
# Changes | ||
* Updated the Rust code derived from `.did` files in the aggregator. | ||
* Note: The candid files under `declarations/nns-$CANISTER` are used as inputs. | ||
# Tests | ||
- [ ] Please check the API updates for any breaking changes that affect our code. | ||
- name: Report on the action | ||
# Since the this is a scheduled job, a failure won't be shown on any | ||
# PR status. To notify the team, we send a message to our Slack channel on failure. | ||
run: | | ||
( | ||
echo "## Aggregator Update" | ||
if test -n "${{ steps.cpr.outputs.pull-request-number }}" | ||
then echo "Created [PR #${{ steps.cpr.outputs.pull-request-number }}](${{ steps.cpr.outputs.pull-request-url }}) with aggregator updates." | ||
else echo "No changes needed." | ||
fi | ||
) | tee -a $GITHUB_STEP_SUMMARY | ||
- name: Notify Slack on failure | ||
uses: dfinity/internet-identity/.github/actions/slack@release-2023-08-28 | ||
if: ${{ failure() }} | ||
with: | ||
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
MESSAGE: "Aggregator update failed" |
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