feat(beta_badge): support warning color value #662
Workflow file for this run
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
name: "Community contribution" | |
on: | |
pull_request_target: | |
types: [opened, reopened] | |
jobs: | |
community-pr-message: | |
env: | |
USER_LOGIN: ${{ github.event.pull_request.user.login }} | |
IS_ORG_MEMBER: "" # https://github.com/github/vscode-github-actions/issues/47 | |
runs-on: ubuntu-latest | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions | |
permissions: | |
issues: write | |
pull-requests: write | |
steps: | |
- name: "Check for org membership" | |
# https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28#check-organization-membership-for-a-user | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-writing-an-environment-variable-to-github_env | |
run: | | |
DATA=$( | |
curl -L -i -g -w "%{http_code}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.EUI_COMMUNITY_PR }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/orgs/elastic/members/"$USER_LOGIN" | |
) | |
HTTP_CODE=$(echo "$DATA" | awk '/([0-9]{3})$/{print}') | |
echo "IS_ORG_MEMBER=$HTTP_CODE" >> "$GITHUB_ENV" | |
- name: "Add comment to community pull requests" | |
uses: actions/github-script@v6 | |
if: ${{ env.IS_ORG_MEMBER != '204' }} | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "π Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?", | |
}); | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['community contribution'] | |
}); |