forked from paritytech/polkadot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 1
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 'upstream/mak-add-prdoc-command'
- Loading branch information
Showing
7 changed files
with
108 additions
and
43 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
requests | ||
cargo-workspace | ||
PyGithub | ||
whatthepatch | ||
pyyaml | ||
toml |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Command | |
|
||
on: | ||
issue_comment: # listen for comments on issues | ||
types: [ created ] | ||
types: [created] | ||
|
||
permissions: # allow the action to comment on the PR | ||
contents: write | ||
|
@@ -35,14 +35,14 @@ jobs: | |
try { | ||
const org = '${{ github.event.repository.owner.login }}'; | ||
const username = '${{ github.event.comment.user.login }}'; | ||
const membership = await github.rest.orgs.checkMembershipForUser({ | ||
org: org, | ||
username: username | ||
}); | ||
console.log(membership, membership.status, membership.status === 204); | ||
if (membership.status === 204) { | ||
return 'true'; | ||
} else { | ||
|
@@ -52,7 +52,7 @@ jobs: | |
} catch (error) { | ||
console.log(error) | ||
} | ||
return 'false'; | ||
reject-non-members: | ||
|
@@ -140,12 +140,14 @@ jobs: | |
} | ||
}) | ||
help: | ||
needs: [ clean, is-org-member ] | ||
needs: [clean, is-org-member] | ||
if: ${{ startsWith(github.event.comment.body, '/cmd') && contains(github.event.comment.body, '--help') && needs.is-org-member.outputs.member == 'true' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Get command | ||
uses: actions-ecosystem/action-regex-match@v2 | ||
|
@@ -173,11 +175,11 @@ jobs: | |
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `<details><summary>Command help:</summary> | ||
\`\`\` | ||
${{ steps.help.outputs.help }} | ||
\`\`\` | ||
</details>` | ||
}) | ||
|
@@ -208,7 +210,7 @@ jobs: | |
}) | ||
set-image: | ||
needs: [ clean, is-org-member ] | ||
needs: [clean, is-org-member] | ||
if: ${{ startsWith(github.event.comment.body, '/cmd') && !contains(github.event.comment.body, '--help') && needs.is-org-member.outputs.member == 'true' }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
|
@@ -222,13 +224,13 @@ jobs: | |
run: | | ||
BODY=$(echo "${{ github.event.comment.body }}" | xargs) | ||
IMAGE_OVERRIDE=$(echo $BODY | grep -oe 'docker.io/paritytech/ci-unified:.*\s' | xargs) | ||
cat .github/env >> $GITHUB_OUTPUT | ||
if [ -n "$IMAGE_OVERRIDE" ]; then | ||
echo "IMAGE=$IMAGE_OVERRIDE" >> $GITHUB_OUTPUT | ||
fi | ||
if [[ $BODY == "/cmd bench"* ]]; then | ||
echo "RUNNER=arc-runners-polkadot-sdk-benchmark" >> $GITHUB_OUTPUT | ||
elif [[ $BODY == "/cmd update-ui"* ]]; then | ||
|
@@ -239,7 +241,7 @@ jobs: | |
# Get PR branch name, because the issue_comment event does not contain the PR branch name | ||
get-pr-branch: | ||
needs: [ set-image ] | ||
needs: [set-image] | ||
runs-on: ubuntu-latest | ||
outputs: | ||
pr-branch: ${{ steps.get-pr.outputs.pr_branch }} | ||
|
@@ -278,9 +280,9 @@ jobs: | |
echo "The repository is ${{ steps.get-pr.outputs.repo }}" | ||
cmd: | ||
needs: [ set-image, get-pr-branch ] | ||
needs: [set-image, get-pr-branch] | ||
env: | ||
JOB_NAME: 'cmd' | ||
JOB_NAME: "cmd" | ||
runs-on: ${{ needs.set-image.outputs.RUNNER }} | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
|
@@ -301,26 +303,25 @@ jobs: | |
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs | jq '.jobs[] | select(.name | contains("${{ env.JOB_NAME }}")) | .html_url') | ||
runLink=$(curl -s \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }} | jq '.html_url') | ||
echo "job_url=${jobLink}" | ||
echo "run_url=${runLink}" | ||
echo "job_url=$jobLink" >> $GITHUB_OUTPUT | ||
echo "run_url=$runLink" >> $GITHUB_OUTPUT | ||
- name: Comment PR (Start) | ||
if: ${{ !contains(github.event.comment.body, '--quiet') }} | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
let job_url = ${{ steps.build-link.outputs.job_url }} | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
|
@@ -331,8 +332,7 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ needs.get-pr-branch.outputs.repo }} | ||
ref: ${{ needs.get-pr-branch.outputs.pr-branch }} | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Install dependencies for bench | ||
if: startsWith(steps.get-pr-comment.outputs.group2, 'bench') | ||
|
@@ -348,6 +348,7 @@ jobs: | |
# Fixes "detected dubious ownership" error in the ci | ||
git config --global --add safe.directory '*' | ||
git remote -v | ||
python3 -m pip install -r .github/scripts/generate-prdoc.requirements.txt | ||
python3 .github/scripts/cmd/cmd.py $CMD | ||
git status | ||
git diff | ||
|
@@ -357,7 +358,7 @@ jobs: | |
if [ -n "$(git status --porcelain)" ]; then | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git pull --rebase origin ${{ needs.get-pr-branch.outputs.pr-branch }} | ||
git add . | ||
git restore --staged Cargo.lock # ignore changes in Cargo.lock | ||
|
@@ -381,7 +382,7 @@ jobs: | |
--change added changed \ | ||
--ignore-errors \ | ||
refs/remotes/origin/master refs/heads/${{ needs.get-pr-branch.outputs.pr-branch }}) | ||
# Save the multiline result to the output | ||
{ | ||
echo "result<<EOF" | ||
|
@@ -393,17 +394,17 @@ jobs: | |
if: ${{ !failure() && !contains(github.event.comment.body, '--quiet') }} | ||
uses: actions/github-script@v7 | ||
env: | ||
SUBWEIGHT: '${{ steps.subweight.outputs.result }}' | ||
SUBWEIGHT: "${{ steps.subweight.outputs.result }}" | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
let runUrl = ${{ steps.build-link.outputs.run_url }} | ||
let subweight = process.env.SUBWEIGHT; | ||
let subweightCollapsed = subweight | ||
? `<details>\n\n<summary>Subweight results:</summary>\n\n${subweight}\n\n</details>` | ||
: ''; | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
|
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.