|
| 1 | +name: Find stale issues |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + # UTC Time |
| 7 | + - cron: "0 7 * * 4" |
| 8 | + |
| 9 | +jobs: |
| 10 | + fetch-issues: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + # List of repositories to fetch the issues |
| 15 | + repo: |
| 16 | + - ink |
| 17 | + - cargo-contract |
| 18 | + - substrate-contracts-node |
| 19 | + - contracts-ui |
| 20 | + - ink-docs |
| 21 | + - smart-bench |
| 22 | + - ink-waterfall |
| 23 | + - ink-playground |
| 24 | + - nft-marketplace-demo |
| 25 | + - pallet-contracts-xcm |
| 26 | + - link |
| 27 | + - ink-examples |
| 28 | + steps: |
| 29 | + - name: Generate token |
| 30 | + id: generate_token |
| 31 | + uses: tibdex/github-app-token@v1 |
| 32 | + with: |
| 33 | + app_id: ${{ secrets.ISSUE_TRACKER_APP_ID }} |
| 34 | + private_key: ${{ secrets.ISSUE_TRACKER_APP_KEY }} |
| 35 | + - name: Fetch issues from ${{ matrix.repo }} |
| 36 | + id: issue |
| 37 | + uses: paritytech/stale-issues-finder@main |
| 38 | + with: |
| 39 | + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} |
| 40 | + repo: ${{ matrix.repo }} |
| 41 | + # Users to ignore if they are authors. They are separated by commas |
| 42 | + ignoreAuthors: ascjones,HCastano,Robbepop,athei,agryaznov,SkymanOne,xermicus,statictype,DoubleOTheven,cmichi,safina12,lean-apple,juangirini,pgherveou |
| 43 | + # only fetch issues that don't have any replies |
| 44 | + noComments: true |
| 45 | + # from today onwards. Increase this number to set how much time without interaction must pass for the issue to be analyzed |
| 46 | + days-stale: 0 |
| 47 | + - run: mkdir outputs |
| 48 | + - name: Write repo data |
| 49 | + run: echo "$DATA" > "$FILE" |
| 50 | + env: |
| 51 | + DATA: ${{ steps.issue.outputs.data }} |
| 52 | + FILE: outputs/${{ matrix.repo }}.json |
| 53 | + - uses: actions/upload-artifact@v3 |
| 54 | + with: |
| 55 | + name: outputs |
| 56 | + path: outputs/*.json |
| 57 | + |
| 58 | + message: |
| 59 | + runs-on: ubuntu-latest |
| 60 | + needs: fetch-issues |
| 61 | + steps: |
| 62 | + - name: Load outputs |
| 63 | + uses: actions/download-artifact@v3 |
| 64 | + with: |
| 65 | + name: outputs |
| 66 | + path: outputs |
| 67 | + - name: Combine outputs |
| 68 | + id: issues |
| 69 | + run: | |
| 70 | + COMBINED=$(jq -s 'reduce .[] as $x ([]; . + $x)' outputs/*.json | tr '\n' ' ') |
| 71 | + COUNT=$(echo $COMBINED | jq length) |
| 72 | + echo "# There are $COUNT stale issues" >> $GITHUB_STEP_SUMMARY |
| 73 | + echo "ISSUES=$COMBINED" >> $GITHUB_OUTPUT |
| 74 | + echo "COUNT=$COUNT" >> $GITHUB_OUTPUT |
| 75 | + - name: Filter to the oldest issues |
| 76 | + id: message |
| 77 | + # Modify the number in reverse[:8] to change how many issues should be shown |
| 78 | + run: | |
| 79 | + if [ $COUNT = "0" ]; then |
| 80 | + echo "MESSAGE=$EMPTY_MESSAGE" >> $GITHUB_OUTPUT |
| 81 | + else |
| 82 | + MESSAGE=$(echo $COMBINED | jq -r '. | sort_by(.daysStale) | reverse[:8]| .[] | "- [\(.title)](\(.url)) | \(.daysStale) days with no reply"') |
| 83 | + delimiter="$(openssl rand -hex 8)" |
| 84 | + echo "MESSAGE<<${delimiter}" >> "${GITHUB_OUTPUT}" |
| 85 | + echo "$MESSAGE" >> "${GITHUB_OUTPUT}" |
| 86 | + echo "${delimiter}" >> "${GITHUB_OUTPUT}" |
| 87 | + fi |
| 88 | + env: |
| 89 | + COMBINED: ${{ steps.issues.outputs.ISSUES }} |
| 90 | + COUNT: ${{ steps.issues.outputs.COUNT }} |
| 91 | + # This is the message that will be shown when there are no |
| 92 | + EMPTY_MESSAGE: "No stale issues! Good job!" |
| 93 | + - name: send message |
| 94 | + |
| 95 | + with: |
| 96 | + room_id: "!EBuECvRavzBxijipBi:parity.io" |
| 97 | + access_token: ${{ secrets.STALE_MATRIX_ACCESS_TOKEN }} |
| 98 | + # Remember to keep at least one empty line between paragraphs |
| 99 | + message: | |
| 100 | + ## Good morning, team 🥞! |
| 101 | + This weekly digest lists GitHub issues without any reply that were created by non-team members. |
| 102 | + |
| 103 | + The list is an aggregation of repositories which the Smart Contracts ☂️ owns ([list](https://www.notion.so/paritytechnologies/What-belongs-to-our-umbrella-b9a80b72fedc47d6b35224a15bdec64c)). |
| 104 | +
|
| 105 | + ${{ steps.message.outputs.MESSAGE }} |
| 106 | +
|
| 107 | + Find all the stale issues [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). |
| 108 | + server: "m.parity.io" |
0 commit comments