github-action: use ephemeral tokens with the required permissions (#1… #25
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: update-compose | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 6 * * *' | ||
permissions: | ||
contents: read | ||
jobs: | ||
compose: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: read | ||
steps: | ||
- uses: actions/checkout@v4 | ||
<<<<<<< HEAD | ||
- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | ||
======= | ||
- name: Get token | ||
id: get_token | ||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | ||
with: | ||
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }} | ||
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} | ||
permissions: >- | ||
{ | ||
"contents": "write", | ||
"pull_requests": "write" | ||
} | ||
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | ||
>>>>>>> abb9a9b09 (github-action: use ephemeral tokens with the required permissions (#14010)) | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: elastic/oblt-actions/updatecli/run@v1 | ||
with: | ||
command: --experimental compose diff | ||
env: | ||
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }} | ||
- uses: elastic/oblt-actions/updatecli/run@v1 | ||
with: | ||
command: --experimental compose apply | ||
env: | ||
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }} | ||
- if: ${{ failure() }} | ||
uses: elastic/oblt-actions/slack/send@v1 | ||
with: | ||
channel-id: '#apm-server' | ||
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>" | ||
bot-token: ${{ secrets.SLACK_BOT_TOKEN }} |