-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into oty-fix-clippy-nightly
- Loading branch information
Showing
26 changed files
with
204 additions
and
1,120 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 |
---|---|---|
|
@@ -13,17 +13,58 @@ on: | |
|
||
jobs: | ||
trigger-review-bot: | ||
# (It is not a draft) && (it is not a review || it is an approving review) | ||
if: ${{ github.event.pull_request.draft != true && (github.event_name != 'pull_request_review' || (github.event.review && github.event.review.state == 'APPROVED')) }} | ||
runs-on: ubuntu-latest | ||
name: trigger review bot | ||
steps: | ||
- name: Get PR data | ||
id: comments | ||
run: | | ||
echo "bodies=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json comments --jq '[.comments[].body]')" >> "$GITHUB_OUTPUT" | ||
echo "reviews=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews --jq '[.[].state]')" >> "$GITHUB_OUTPUT" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- name: Get the GitHub handle of the fellows | ||
uses: paritytech/[email protected] | ||
id: fellows | ||
# Require new reviews when the author is pushing and he is not a fellow | ||
- name: Fail when author pushes new code | ||
# if (contains approved reviews && it's a synchronize event && was triggered by the author (who is not a fellow)) | ||
if: | | ||
contains(fromJson(steps.comments.outputs.reviews), 'APPROVED') && | ||
github.event_name == 'pull_request_target' && | ||
github.event.action == 'synchronize' && | ||
github.event.sender.login == github.event.pull_request.user.login && | ||
contains(steps.fellows.outputs.github-handles, github.event.pull_request.user.login) | ||
run: | | ||
# We get the list of reviewers who approved the PR | ||
REVIEWERS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \ | ||
--jq '{reviewers: [.[] | select(.state == "APPROVED") | .user.login]}') | ||
# We request them to review again | ||
echo $REVIEWERS | gh api --method POST repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers --input - | ||
echo "::error::Project needs to be reviewed again" | ||
exit 1 | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- name: Comment requirements | ||
# If the previous step failed and github-actions hasn't commented yet we comment instructions | ||
if: failure() && !contains(fromJson(steps.comments.outputs.bodies), 'Review required! Latest push from author must always be reviewed') | ||
run: | | ||
gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "Review required! Latest push from author must always be reviewed" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
COMMENTS: ${{ steps.comments.outputs.users }} | ||
- name: Get PR number | ||
env: | ||
PR_NUMBER: ${{ github.event.pull_request.number }} | ||
run: | | ||
echo "Saving PR number: $PR_NUMBER" | ||
mkdir -p ./pr | ||
echo $PR_NUMBER > ./pr/pr_number | ||
- uses: actions/upload-artifact@v3 | ||
- uses: actions/upload-artifact@v4 | ||
name: Save PR number | ||
with: | ||
name: pr_number | ||
|
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
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 |
---|---|---|
|
@@ -4,6 +4,9 @@ on: | |
push: | ||
branches: | ||
- main | ||
workflow_run: | ||
workflows: [Auto Merge Bot] | ||
types: [completed] | ||
|
||
jobs: | ||
updatePullRequests: | ||
|
@@ -13,11 +16,11 @@ jobs: | |
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v1 | ||
uses: actions/create-github-app-token@v1.9.3 | ||
with: | ||
app_id: ${{ secrets.MERGE_APP_ID }} | ||
private_key: ${{ secrets.MERGE_APP_KEY }} | ||
app-id: ${{ secrets.MERGE_APP_ID }} | ||
private-key: ${{ secrets.MERGE_APP_KEY }} | ||
- name: Update all the PRs | ||
uses: paritytech/[email protected].0 | ||
uses: paritytech/[email protected].1 | ||
with: | ||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
77 changes: 77 additions & 0 deletions
77
...tion-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship_salary.rs
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,77 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use crate::*; | ||
use asset_hub_polkadot_runtime::xcm_config::LocationToAccountId; | ||
use collectives_polkadot_runtime::fellowship::FellowshipSalaryPaymaster; | ||
use frame_support::{ | ||
assert_ok, | ||
traits::{ | ||
fungibles::{Create, Mutate}, | ||
tokens::Pay, | ||
}, | ||
}; | ||
use xcm_executor::traits::ConvertLocation; | ||
|
||
const FELLOWSHIP_SALARY_PALLET_ID: u8 = | ||
collectives_polkadot_runtime_constants::FELLOWSHIP_SALARY_PALLET_INDEX; | ||
|
||
#[test] | ||
fn pay_salary() { | ||
let asset_id: u32 = 1984; | ||
let fellowship_salary = ( | ||
Parent, | ||
Parachain(CollectivesPolkadot::para_id().into()), | ||
PalletInstance(FELLOWSHIP_SALARY_PALLET_ID), | ||
); | ||
let pay_from = LocationToAccountId::convert_location(&fellowship_salary.into()).unwrap(); | ||
let pay_to = Polkadot::account_id_of(ALICE); | ||
let pay_amount = 9000; | ||
|
||
AssetHubPolkadot::execute_with(|| { | ||
type AssetHubAssets = <AssetHubPolkadot as AssetHubPolkadotPallet>::Assets; | ||
|
||
assert_ok!(<AssetHubAssets as Create<_>>::create( | ||
asset_id, | ||
pay_to.clone(), | ||
true, | ||
pay_amount / 2 | ||
)); | ||
assert_ok!(<AssetHubAssets as Mutate<_>>::mint_into(asset_id, &pay_from, pay_amount * 2)); | ||
}); | ||
|
||
CollectivesPolkadot::execute_with(|| { | ||
type RuntimeEvent = <CollectivesPolkadot as Chain>::RuntimeEvent; | ||
|
||
assert_ok!(FellowshipSalaryPaymaster::pay(&pay_to, (), pay_amount)); | ||
assert_expected_events!( | ||
CollectivesPolkadot, | ||
vec![ | ||
RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) => {}, | ||
] | ||
); | ||
}); | ||
|
||
AssetHubPolkadot::execute_with(|| { | ||
type RuntimeEvent = <AssetHubPolkadot as Chain>::RuntimeEvent; | ||
assert_expected_events!( | ||
AssetHubPolkadot, | ||
vec![ | ||
RuntimeEvent::Assets(pallet_assets::Event::Transferred { .. }) => {}, | ||
RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { success: true ,.. }) => {}, | ||
] | ||
); | ||
}); | ||
} |
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
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
Oops, something went wrong.