Skip to content

Commit

Permalink
Merge pull request #5091 from systeminit/fix_try
Browse files Browse the repository at this point in the history
fix: try comments have incorrect permissions
  • Loading branch information
stack72 authored Dec 9, 2024
2 parents 6e5d408 + 0585721 commit ffa4851
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions .github/workflows/try.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,19 @@ on:
permissions:
contents: read
issues: write
pull-requests: read
pull-requests: write

jobs:
try:
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/try') }}
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
id: create-comment
- uses: peter-evans/create-or-update-comment@v4
id: init-comment
with:
script: |
const { data } = await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Okay, starting a try! I\'ll update this comment when it starts...'
});
return { id: data.id };
issue-number: ${{ github.event.pull_request.number }}
body: |
Okay, starting a try! I\'ll update this comment once it\'s running...\n
- uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
Expand All @@ -39,19 +34,9 @@ jobs:
ignore_pipeline_branch_filter: true
send_pull_request: true

- uses: actions/github-script@v7
- uses: peter-evans/create-or-update-comment@v4
with:
script: |
const commentId = "${{ steps.create-comment.outputs.id }}";
const buildUrl = "${{ steps.run-build.outputs.url }}";
if (!commentId || !buildUrl) {
throw new Error("Missing comment ID or build URL.");
}
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: commentId,
body: `πŸš€ [Try running here](${buildUrl})! πŸš€`
});
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.init-comment.outputs.comment-id }}
body: |
πŸš€ [Try running here](${{ steps.run-build.outputs.url }})! πŸš€

0 comments on commit ffa4851

Please sign in to comment.