-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into aj/restrict-wildcard-selectors
- Loading branch information
Showing
59 changed files
with
432 additions
and
159 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,59 @@ | ||
import uuid | ||
import json | ||
import glob | ||
import sys | ||
import os | ||
|
||
|
||
def set_output(name, value): | ||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | ||
print(f'{name}={value}', file=fh) | ||
|
||
|
||
def set_multiline_output(name, value): | ||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: | ||
delimiter = uuid.uuid1() | ||
print(f'{name}<<{delimiter}', file=fh) | ||
print(value, file=fh) | ||
print(delimiter, file=fh) | ||
|
||
|
||
if len(sys.argv) > 1: | ||
limit = int(sys.argv[1]) | ||
else: | ||
limit = 999 | ||
|
||
result = [] | ||
for f in glob.glob("outputs/*.json"): | ||
with open(f, "r") as infile: | ||
result += json.load(infile) | ||
|
||
sorted_data = sorted(result, key=lambda x: x['daysStale']) | ||
sorted_data.reverse() | ||
|
||
count = len(sorted_data) | ||
|
||
set_output("COUNT", count) | ||
|
||
if count < 1: | ||
set_output("MESSAGE", "") | ||
exit() | ||
|
||
sliced_list = sorted_data[:limit] | ||
|
||
formated_list = [] | ||
for i, data in enumerate(sliced_list): | ||
message = str( | ||
f' {i + 1}. [{data["title"]}]({data["url"]}) | {data["daysStale"]} days with no reviews') | ||
formated_list.append(message) | ||
|
||
with open(os.environ['GITHUB_STEP_SUMMARY'], 'a') as fh: | ||
print(f'## There are {count} stale PRs', file=fh) | ||
for message in formated_list: | ||
print(f'{message}', file=fh) | ||
|
||
message = "\n".join(formated_list) | ||
|
||
set_multiline_output("MESSAGE", message) | ||
|
||
set_output("data", json.dumps(formated_list)) |
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,102 @@ | ||
name: Find stale PRs | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 7 * * 4" | ||
|
||
jobs: | ||
fetch-issues: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
max-parallel: 3 | ||
matrix: | ||
# List of repositories to fetch the issues | ||
repo: | ||
- ink | ||
- cargo-contract | ||
- substrate-contracts-node | ||
- contracts-ui | ||
- ink-docs | ||
- smart-bench | ||
- ink-waterfall | ||
- ink-playground | ||
- nft-marketplace-demo | ||
- pallet-contracts-xcm | ||
- link | ||
- ink-examples | ||
- useink | ||
- awesome-ink | ||
- squink-splash-beginner | ||
- squink-splash-advanced | ||
- ink-workshop | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: tibdex/github-app-token@v1 | ||
with: | ||
app_id: ${{ secrets.ISSUE_TRACKER_APP_ID }} | ||
private_key: ${{ secrets.ISSUE_TRACKER_APP_KEY }} | ||
- run: mkdir outputs | ||
- name: Fetch PRs from ${{ matrix.repo }} | ||
id: pr | ||
uses: paritytech/stale-pr-finder@main | ||
with: | ||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
repo: ${{ matrix.repo }} | ||
# only fetch PRs that don't have any reviews | ||
noReviews: true | ||
# from today onwards. Increase this number to set how much time without interaction must pass for the issue to be analyzed | ||
days-stale: 0 | ||
fileOutput: outputs/${{ matrix.repo }}.json | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: outputs | ||
path: outputs/*.json | ||
|
||
message: | ||
runs-on: ubuntu-latest | ||
needs: fetch-issues | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Load outputs | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: outputs | ||
path: outputs | ||
- name: Run combine script | ||
id: pr | ||
run: python ./.github/scripts/combine-pr.py $LIMIT | ||
shell: bash | ||
env: | ||
# How many PRs to show in the message | ||
LIMIT: 8 | ||
- name: send message | ||
if: ${{ steps.pr.outputs.MESSAGE != '' }} | ||
uses: s3krit/matrix-message-action@v0.0.3 | ||
with: | ||
room_id: "!EBuECvRavzBxijipBi:parity.io" | ||
access_token: ${{ secrets.STALE_MATRIX_ACCESS_TOKEN }} | ||
# Remember to keep at least one empty line between paragraphs | ||
message: | | ||
## Good morning, team 🥐! | ||
This weekly digest contains the longest unreviewed pull requests from repositories which the Smart Contracts ☂️ owns ([list](https://www.notion.so/paritytechnologies/What-belongs-to-our-umbrella-b9a80b72fedc47d6b35224a15bdec64c)). | ||
${{ steps.pr.outputs.MESSAGE }} | ||
Unfortunately there are more stale PRs. The above list is limited to 8 entries. Find all the stale PRs [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). | ||
server: "m.parity.io" | ||
- name: send message for no PRs found | ||
if: ${{ steps.pr.outputs.MESSAGE == '' }} | ||
uses: s3krit/matrix-message-action@v0.0.3 | ||
with: | ||
room_id: "!EBuECvRavzBxijipBi:parity.io" | ||
access_token: ${{ secrets.STALE_MATRIX_ACCESS_TOKEN }} | ||
# Remember to keep at least one empty line between paragraphs | ||
message: | | ||
## Good morning, team 🥐! | ||
We have no Pull Requests waiting for reviews. | ||
**Good job everyone!** | ||
server: "m.parity.io" |
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
Oops, something went wrong.