This repository has been archived by the owner on May 18, 2023. It is now read-only.
forked from w3f/Grant-Milestone-Delivery
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (73 loc) · 3.64 KB
/
badge.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Award Badge
on:
pull_request_target:
types: [closed]
jobs:
get-delivery-files:
runs-on: ubuntu-latest
outputs:
filenames: ${{ steps.files.outputs.added }}
steps:
- name: Get filenames of any deliveries being added
id: files
uses: Ana06/[email protected]
with:
format: 'json'
filter: |
deliveries/*.md
maintenance_deliveries/*.md
check-needs-badge:
runs-on: ubuntu-latest
needs: get-delivery-files
if: github.event.pull_request.merged == true && needs.get-delivery-files.outputs.filenames != '[]'
outputs:
needs_badge: ${{ steps.badge-check.outputs.check }}
strategy:
max-parallel: 1
fail-fast: false
matrix:
filename: ${{ fromJson(needs.get-delivery-files.outputs.filenames) }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Parse delivery file
id: parse-delivery
uses: w3f/parse-milestone-delivery-action@v3
with:
path: "${{ github.workspace }}/${{ matrix.filename }}"
- name: Get application file
run: wget "https://raw.githubusercontent.com/w3f/Grants-Program/master/applications/${{ steps.parse-delivery.outputs.application_document }}"
- name: Parse application file
id: parse-grant
uses: w3f/parse-grant-application-action@v1
with:
path: "${{ steps.parse-delivery.outputs.application_document }}"
- name: Check if this PR needs a badge comment
id: badge-check
# A matrix strategy overwrites outputs, meaning `needs_badge` will be `true` if atleast one of the files matches the following condition.
# This way, there'll only be max 1 comment left per PR
if: steps.parse-delivery.outputs.milestone_number == 1 && steps.parse-grant.outputs.level != 1
run: echo "::set-output name=check::true"
comment-badge:
runs-on: ubuntu-latest
needs: check-needs-badge
if: needs.check-needs-badge.outputs.needs_badge
steps:
- name: Leave badge comment if applicable
uses: thollander/[email protected]
with:
message: >
Congratulations on completing the first milestone of this grant!
As part of the Grants Program, we want to help grant recipients acknowledge their grants publicly.
To that end, we’ve created a [badge for projects](https://github.com/w3f/Grants-Program/blob/master/docs/Support%20Docs/grant-badge-guidelines.md)
that successfully deliver their first milestone.
Note that it must only be used within the context of the delivered work, so please do not display it on
your team or project's homepage unless accompanied by a short description of the grant.<br/><br/>
Furthermore, you're now welcome to announce the grant publicly. Please remember to observe the
[foundation’s guidelines](https://github.com/w3f/Grants-Program/blob/master/docs/Support%20Docs/announcement-guidelines.md) in doing so.
In case you haven't done so yet, you may also reach out to [email protected] for feedback on your announcement and cross-promotion.<br/><br/>
Thank you for your contribution and good luck with the remaining milestones, if any!
As usual, please let us know if you run into any delays by leaving a comment on the application PR, or directly submitting an
[amendment](https://github.com/w3f/Grants-Program#changes-to-a-grant-after-approval).
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}