-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # packages/hooks/src/test/index.test.js
- Loading branch information
Showing
1,453 changed files
with
63,249 additions
and
25,112 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,6 +1,11 @@ | ||
.cache | ||
build | ||
build-module | ||
node_modules | ||
packages/block-serialization-spec-parser/parser.js | ||
packages/e2e-tests/plugins | ||
playground/dist | ||
vendor | ||
packages/block-serialization-spec-parser/parser.js | ||
wordpress | ||
|
||
!.eslintrc.js |
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
Validating CODEOWNERS rules …
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,18 @@ | ||
FROM debian:stable-slim | ||
|
||
LABEL "name"="Assign Fixed Issues" | ||
LABEL "maintainer"="The WordPress Contributors" | ||
LABEL "version"="1.0.0" | ||
|
||
LABEL "com.github.actions.name"="Assign Fixed Issues" | ||
LABEL "com.github.actions.description"="Assigns the issues fixed by a pull request to the author of that pull request" | ||
LABEL "com.github.actions.icon"="flag" | ||
LABEL "com.github.actions.color"="green" | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y jq curl ca-certificates && \ | ||
apt-get clean -y | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
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,51 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# 1. Find the issues that this PR 'fixes'. | ||
|
||
issues=$( | ||
jq -r '.pull_request.body' $GITHUB_EVENT_PATH | perl -nle 'print $1 while / | ||
(?:close|closes|closed|fix|fixes|fixed|resolve|resolves|resolved) | ||
:? | ||
\ + | ||
(?:\#?|https?:\/\/github\.com\/WordPress\/gutenberg\/issues\/) | ||
(\d+) | ||
/igx' | ||
) | ||
|
||
if [ -z "$issues" ]; then | ||
echo "Pull request does not 'fix' any issues. Aborting." | ||
exit 78 | ||
fi | ||
|
||
# 2. Grab the author of the PR. | ||
|
||
author=$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH) | ||
|
||
# 3. Loop through each 'fixed' issue. | ||
|
||
for issue in $issues; do | ||
|
||
# 3a. Add the author as an asignee to the issue. This fails if the author is | ||
# already assigned, which is expected and ignored. | ||
|
||
curl \ | ||
--silent \ | ||
-X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"assignees\":[\"$author\"]}" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$issue/assignees" > /dev/null | ||
|
||
# 3b. Label the issue as 'In Progress'. This fails if the label is already | ||
# applied, which is expected and ignored. | ||
|
||
curl \ | ||
--silent \ | ||
-X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"labels":["[Status] In Progress"]}' \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$issue/labels" > /dev/null | ||
|
||
done |
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,18 @@ | ||
FROM debian:stable-slim | ||
|
||
LABEL "name"="First Time Contributor" | ||
LABEL "maintainer"="The WordPress Contributors" | ||
LABEL "version"="1.0.0" | ||
|
||
LABEL "com.github.actions.name"="First Time Contributor" | ||
LABEL "com.github.actions.description"="Assigns the first time contributor label to pull requests" | ||
LABEL "com.github.actions.icon"="award" | ||
LABEL "com.github.actions.color"="green" | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y jq curl ca-certificates && \ | ||
apt-get clean -y | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT [ "/entrypoint.sh" ] |
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,35 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# 1. Get the author and pr number for the pull request. | ||
author=$(jq -r '.pull_request.user.login' $GITHUB_EVENT_PATH) | ||
pr_number=$(jq -r '.number' $GITHUB_EVENT_PATH) | ||
|
||
if [ "$pr_number" = "null" ] || [ "$author" = "null" ]; then | ||
echo "Could not find PR number or author. $pr_number / $author" | ||
exit 78 | ||
fi | ||
|
||
# 2. Fetch the author's commit count for the repo to determine if they're a first-time contributor. | ||
commit_count=$( | ||
curl \ | ||
--silent \ | ||
-H "Accept: application/vnd.github.cloak-preview" \ | ||
"https://api.github.com/search/commits?q=repo:$GITHUB_REPOSITORY+author:$author" \ | ||
| jq -r '.total_count' | ||
) | ||
|
||
# 3. If the response has a commit count of zero, exit early, the author is not a first time contributor. | ||
if [ "$commit_count" != "0" ]; then | ||
echo "Pull request #$pr_number was not created by a first-time contributor ($author)." | ||
exit 78 | ||
fi | ||
|
||
# 4. Assign the 'First Time Contributor' label. | ||
curl \ | ||
--silent \ | ||
-X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Content-Type: application/json" \ | ||
-d '{"labels":["First-time Contributor"]}' \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$pr_number/labels" > /dev/null |
Oops, something went wrong.