Skip to content

Commit

Permalink
[8.15] github-actions: grant write permissions to report to the issues (
Browse files Browse the repository at this point in the history
elastic#195706) (elastic#195923)

# Backport

This will backport the following commits from `main` to `8.15`:
- [github-actions: grant write permissions to report to the issues
(elastic#195706)](elastic#195706)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Victor
Martinez","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-10T10:35:03Z","message":"github-actions:
grant write permissions to report to the issues
(elastic#195706)","sha":"44a42a7a2a22e0ee7ed6d1f8deb1f5f12ca2b155","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major","ci:project-deploy-observability","v8.16.0"],"number":195706,"url":"https://github.com/elastic/kibana/pull/195706","mergeCommit":{"message":"github-actions:
grant write permissions to report to the issues
(elastic#195706)","sha":"44a42a7a2a22e0ee7ed6d1f8deb1f5f12ca2b155"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195706","number":195706,"mergeCommit":{"message":"github-actions:
grant write permissions to report to the issues
(elastic#195706)","sha":"44a42a7a2a22e0ee7ed6d1f8deb1f5f12ca2b155"}},{"branch":"8.x","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/195738","number":195738,"state":"MERGED","mergeCommit":{"sha":"950e0738909399ab30830bda6b9b65e8747c5115","message":"[8.x]
github-actions: grant write permissions to report to the issues
(elastic#195706) (elastic#195738)\n\n# Backport\n\nThis will backport the following
commits from `main` to `8.x`:\n- [github-actions: grant write
permissions to report to the
issues\n(elastic#195706)](https://github.com/elastic/kibana/pull/195706)\n\n<!---
Backport version: 9.4.3 -->\n\n### Questions ?\nPlease refer to the
[Backport
tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT
[{\"author\":{\"name\":\"Victor\nMartinez\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2024-10-10T10:35:03Z\",\"message\":\"github-actions:\ngrant
write permissions to report to the
issues\n(elastic#195706)\",\"sha\":\"44a42a7a2a22e0ee7ed6d1f8deb1f5f12ca2b155\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.16.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"release_note:skip\",\"v9.0.0\",\"backport:prev-major\"],\"title\":\"github-actions:\ngrant
write permissions to report to
the\nissues\",\"number\":195706,\"url\":\"https://github.com/elastic/kibana/pull/195706\",\"mergeCommit\":{\"message\":\"github-actions:\ngrant
write permissions to report to the
issues\n(elastic#195706)\",\"sha\":\"44a42a7a2a22e0ee7ed6d1f8deb1f5f12ca2b155\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/195706\",\"number\":195706,\"mergeCommit\":{\"message\":\"github-actions:\ngrant
write permissions to report to the
issues\n(elastic#195706)\",\"sha\":\"44a42a7a2a22e0ee7ed6d1f8deb1f5f12ca2b155\"}}]}]\nBACKPORT-->\n\nCo-authored-by:
Victor Martinez <[email protected]>"}}]}] BACKPORT-->
  • Loading branch information
v1v authored Oct 11, 2024
1 parent d3bf6ba commit b1f457a
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions .github/workflows/oblt-github-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,27 @@
name: oblt-github-commands

on:
pull_request_target:
pull_request:
types:
- opened
- labeled

permissions:
contents: read
issues: write
pull-requests: write

jobs:
comment-if-oblt-member:
comment:
if: ${{ github.event.label.name == 'ci:project-deploy-observability' }}
runs-on: ubuntu-latest
steps:
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
url: ${{ secrets.OBLT_VAULT_ADDR }}
roleId: ${{ secrets.OBLT_VAULT_ROLE_ID }}
secretId: ${{ secrets.OBLT_VAULT_SECRET_ID }}

- id: is_team_member
name: Check if user is member of the Elastic org and Observability team
run: |
if gh api -H "Accept: application/vnd.github+json" \
/orgs/elastic/teams/observability/memberships/${{ github.actor }} ; then
echo "result=true" >> $GITHUB_OUTPUT
else
echo "result=false" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ env.GITHUB_TOKEN }}

- if: ${{ steps.is_team_member.outputs.result == 'true' }}
uses: actions/github-script@v6
with:
github-token: ${{ env.GITHUB_TOKEN }}
script: |
const body = `
### :robot: GitHub comments
<details><summary>Expand to view the GitHub comments</summary>
<p>
Just comment with:
- \`/oblt-deploy\` : Deploy a Kibana instance using the Observability test environments.
- \`run\` \`docs-build\` : Re-trigger the docs validation. (use unformatted text in the comment!)
Expand Down

0 comments on commit b1f457a

Please sign in to comment.