-
Notifications
You must be signed in to change notification settings - Fork 522
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' of github.com:w3f/Grant-Milestone-Delivery
- Loading branch information
Showing
21 changed files
with
438 additions
and
123 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 |
---|---|---|
@@ -1,36 +1 @@ | ||
# Testing workflows | ||
|
||
While it requires some assumptions & is somewhat limited in scope, it's possible to run local testing on some of the workflows | ||
|
||
## Setup | ||
0. Setup your Google API Credentials on https://console.developers.google.com/ | ||
- Credentials -> Create Credentials -> Service Accounts | ||
|
||
1. Follow the instructions for installing [act](https://github.com/nektos/act) | ||
|
||
2. The act environment is configured via `.actrc` & `.env` files. For this repo, we set: | ||
- the docker image used for testing to `nektos/act-environments-ubuntu:18.04`, corresponding to GitHub's test environment. Probably not all features are necessary, but we rely for example on the presence of `jq` in the image for JSON parsing | ||
- `ACT=true` environment variable. This way we can distinguish which steps to run | ||
|
||
3. Pull the above mentioned docker image: | ||
`docker pull nektos/act-environments-ubuntu:18.04` | ||
|
||
### Local Testing | ||
|
||
4. Modify the `google_sheet_update.yml` to replace the `parse files` section with `local testing parse files` (since they have the same ID, they can't both be used in the yml or else GitHub will complain). They should both be there by default, it's just a matter of commenting one section out | ||
|
||
### Fork Testing | ||
4. Fork the Open Grants Repo | ||
|
||
5. Set up your secrets under the fork/settings: | ||
- GSHEET_PRIVATE_KEY | ||
- GSHEET_CLIENT_EMAIL | ||
- SPREADSHEET_ID | ||
|
||
6. Branch off from master. Create a PR with only 1 file added (e.g. `cp deliveries/.delivery_testing.md deliveries/.delivery_testing_2.md`, add & commit it). To trigger the workflow, you need to merge the PR (into your own fork). Note: Push any changes to fork's master branch before you branch off, because the workflow to run will be the one from master. | ||
|
||
## Usage | ||
|
||
``` | ||
act -s GSHEET_PRIVATE_KEY="$(< .gsheet_private_key)" -s GSHEET_CLIENT_EMAIL="$(< .gsheet_client_email)" -s SPREADSHEET_ID="$(< .spreadsheet_id)" -e .pr_event.json -j update_sheet | ||
``` | ||
Basic instructions on workflow testing can be found [in the grants repo](https://github.com/w3f/Grants-Program/blob/master/.github/workflows/README.md). |
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,45 @@ | ||
name: Award Badge | ||
on: | ||
pull_request_target: | ||
types: [closed] | ||
|
||
jobs: | ||
badge: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Parse delivery file | ||
id: delivery | ||
uses: ./.github/workflows/composite/get_delivery | ||
|
||
- name: Get application file | ||
if: steps.delivery.outputs.filenames | ||
run: wget "https://raw.githubusercontent.com/w3f/Grants-Program/master/applications/${{ steps.delivery.outputs.application-filename }}" | ||
|
||
- name: Parse application file | ||
id: parse-grant | ||
if: steps.delivery.outputs.filenames | ||
uses: w3f/parse-grant-application-action@v1 | ||
with: | ||
path: "${{ steps.delivery.outputs.application-filename }}" | ||
|
||
- name: Leave badge comment if applicable | ||
if: steps.delivery.outputs.filenames && steps.delivery.outputs.milestone-number == 1 && steps.parse-grant.outputs.level != 1 | ||
uses: thollander/actions-comment-pull-request@1.0.1 | ||
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/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/announcement-guidelines.md) in doing so. | ||
In case you haven't done so yet, you may also reach out to grantsPR@web3.foundation 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 }} |
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,31 @@ | ||
name: Check Author | ||
on: | ||
pull_request_target: | ||
types: [opened] | ||
|
||
jobs: | ||
check_author: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Parse delivery file | ||
id: delivery | ||
uses: ./.github/workflows/composite/get_delivery | ||
|
||
- name: Find PR author in application authors | ||
if: steps.delivery.outputs.filenames | ||
uses: actions/github-script@v5 | ||
env: | ||
pr_author: ${{ github.event.pull_request.user.login }} | ||
with: | ||
script: | | ||
await github.rest.repos.listCommits({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
path: 'applications/${{ steps.delivery.outputs.application_document }}' | ||
}).then( app_commits => { | ||
app_authors = app_commits.data.map(c => {return c.author.login}); | ||
if(!app_authors.includes(process.env.pr_author)) | ||
core.setFailed('PR author does not match any application author.'); | ||
}); |
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,33 @@ | ||
name: Parse Delivery | ||
outputs: | ||
filenames: | ||
description: Filenames of all delivery documents | ||
value: ${{ steps.files.outputs.added }} | ||
milestone-number: | ||
description: Milestone number | ||
value: ${{ steps.parse-delivery.outputs.milestone_number }} | ||
application-filename: | ||
description: Filename of the application document | ||
value: ${{ steps.parse-delivery.outputs.application_document }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Get filenames of any deliveries being added | ||
id: files | ||
uses: Ana06/get-changed-files@v2.0.0 | ||
with: | ||
filter: 'deliveries/*.md' | ||
|
||
- name: Parse delivery file # TODO parse all files separately if there are multiple | ||
if: steps.files.outputs.added | ||
id: parse-delivery | ||
uses: w3f/parse-milestone-delivery-action@v3 | ||
with: | ||
path: "${{ github.workspace }}/${{ steps.files.outputs.added }}" | ||
|
||
- uses: actions/checkout@v2 # Return to master branch (otherwise the composite action fails) |
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,60 @@ | ||
|
||
# Created by https://www.toptal.com/developers/gitignore/api/macos,windows | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows | ||
|
||
### macOS ### | ||
# General | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
Thumbs.db:encryptable | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Dump file | ||
*.stackdump | ||
|
||
# Folder config file | ||
[Dd]esktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msix | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/macos,windows |
This file was deleted.
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
Oops, something went wrong.