Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github-action: support PR author implicitely #2600

Merged
merged 2 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/actions/is-pr-author-member-elastic-org/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
repository: ${{ github.repository }}
token: ${{ secrets.PAT_TOKEN }}
- if: steps.is_pr_author_elastic_member.outputs.result == true
run: echo 'PR author of ${{ github.event.issue.number }} is Elastic member'
run: echo 'PR author "${{ steps.is_pr_author_elastic_member.outputs.author }}" of ${{ github.event.issue.number }} is Elastic member'
```


Expand All @@ -53,3 +53,4 @@ Following inputs can be used as `step.with` keys
| Name | Type | Description |
|-------------------|---------| ----------------------------|
| `result` | Boolean | Whether the PR author is member. |
| `author` | String | The PR author. |
3 changes: 3 additions & 0 deletions .github/actions/is-pr-author-member-elastic-org/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ outputs:
result:
description: 'The result in either true or false'
value: ${{ steps.is_elastic_pr_author.outputs.result }}
author:
kuisathaverat marked this conversation as resolved.
Show resolved Hide resolved
description: 'The Pull Request author'
value: ${{ steps.gh_api_pr_author.outputs.result }}
runs:
using: "composite"
steps:
Expand Down
1 change: 0 additions & 1 deletion .github/actions/undeploy-my-kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Following inputs can be used as `step.with` keys
| Name | Type | Default | Description |
|-------------------|---------|---------------------------------------------------------|------------------------------------|
| `pull-request` | String | `${{ github.event.pull_request.number }}` | The GitHub Pull Request ID. |
| `user` | String | `${{ github.event.pull_request.head.repo.owner.login }}`| The GitHub user avatar |
| `repository` | String | `${{ github.repository }}` | The GitHub repository, ORG/REPO. |
| `token` | String | | GitHub token. |

Expand Down
20 changes: 9 additions & 11 deletions .github/actions/undeploy-my-kibana/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@ inputs:
repository:
description: 'The GitHub repository'
default: ${{ github.repository }}
user:
description: 'The GitHub PR onwer'
default: ${{ github.event.pull_request.head.repo.owner.login }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This context didn't work well for PRs in the upstream

token:
description: 'The GitHub access token.'
required: true
runs:
using: "composite"
steps:
- name: Is an Elastician comment?
id: is_elastic_member
uses: elastic/apm-pipeline-library/.github/actions/is-member-elastic-org@current

- id: is_elastic_pr_author
uses: elastic/apm-pipeline-library/.github/actions/is-pr-author-member-elastic-org@current
with:
username: ${{ inputs.user }}
pull-request: ${{ inputs.pull-request }}
repository: ${{ inputs.repository }}
token: ${{ inputs.token }}

- name: Create github issue body
if: contains(steps.is_elastic_member.outputs.result, 'true')
if: contains(steps.is_elastic_pr_author.outputs.result, 'true')
run: |-
cat <<EOT >> .body-content
### Kibana pull request
Expand All @@ -39,11 +37,11 @@ runs:
env:
REPO: ${{ inputs.repository }}
PR: ${{ inputs.pull-request }}
USER: ${{ inputs.user }}
USER: ${{ steps.is_elastic_pr_author.outputs.author }}
shell: bash

- name: Create github issue for the undeploy-my-kibana
if: contains(steps.is_elastic_member.outputs.result, 'true')
if: contains(steps.is_elastic_pr_author.outputs.result, 'true')
run: |
gh issue \
create \
Expand All @@ -57,5 +55,5 @@ runs:
GH_TOKEN: ${{ inputs.token }}
PR: ${{ inputs.pull-request }}
REPO: ${{ inputs.repository }}
USER: ${{ inputs.user }}
USER: ${{ steps.is_elastic_pr_author.outputs.author }}
shell: bash
Loading