mirror of
https://github.com/esphome/esphome.git
synced 2026-06-01 17:57:37 +08:00
[ci] Fix external-component-bot 403 on PR comments (#16354)
This commit is contained in:
@@ -4,19 +4,29 @@ on:
|
|||||||
pull_request_target:
|
pull_request_target:
|
||||||
types: [opened, synchronize]
|
types: [opened, synchronize]
|
||||||
|
|
||||||
permissions:
|
# All API calls (pulls.listFiles + issues.{list,create,update}Comment) are performed with
|
||||||
issues: write # issues.createComment / updateComment to post the external-component usage instructions on the PR
|
# the App token minted below, so the workflow's GITHUB_TOKEN does not need any scopes.
|
||||||
pull-requests: read # pulls.listFiles to enumerate which components changed
|
permissions: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
external-comment:
|
external-comment:
|
||||||
name: External component comment
|
name: External component comment
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Generate a token
|
||||||
|
id: generate-token
|
||||||
|
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
|
||||||
|
with:
|
||||||
|
client-id: ${{ vars.ESPHOME_GITHUB_APP_CLIENT_ID }}
|
||||||
|
private-key: ${{ secrets.ESPHOME_GITHUB_APP_PRIVATE_KEY }}
|
||||||
|
# pulls.listFiles + issues.{list,create,update}Comment on PRs. For PR resources
|
||||||
|
# the issues.*Comment APIs require the pull-requests scope, not issues.
|
||||||
|
permission-pull-requests: write
|
||||||
|
|
||||||
- name: Add external component comment
|
- name: Add external component comment
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ steps.generate-token.outputs.token }}
|
||||||
script: |
|
script: |
|
||||||
// Generate external component usage instructions
|
// Generate external component usage instructions
|
||||||
function generateExternalComponentInstructions(prNumber, componentNames, owner, repo) {
|
function generateExternalComponentInstructions(prNumber, componentNames, owner, repo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user