diff --git a/.github/workflows/cmd.yml b/.github/workflows/cmd.yml index 3fe2dcf022..428a83360b 100644 --- a/.github/workflows/cmd.yml +++ b/.github/workflows/cmd.yml @@ -53,6 +53,38 @@ jobs: content: 'eyes' }) + - name: Generate a token + id: commands_token + uses: actions/create-github-app-token@v1.8.1 + with: + app-id: ${{ secrets.COMMAND_APP_ID }} + private-key: ${{ secrets.COMMAND_APP_KEY }} + + + - name: Clean previous comments + if: ${{ contains(github.event.comment.body, '--clean') }} + uses: actions/github-script@v7 + with: + github-token: ${{ steps.commands_token.outputs.token }} + script: | + github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo + }).then(comments => { + for (let comment of comments.data) { + console.log(comment) + console.log(comment.author) + if (comment.body.startsWith('Command') && comment.author.login === 'github-actions[bot]') { + github.rest.issues.deleteComment({ + comment_id: comment.id, + owner: context.repo.owner, + repo: context.repo.repo + }) + } + } + }) + cmd: if: ${{ startsWith(github.event.comment.body, '/cmd') && !contains(github.event.comment.body, '--help') }} runs-on: ${{ startsWith(github.event.comment.body, '/cmd bench') && 'arc-runners-beefy-stg' || 'ubuntu-22.04' }} @@ -95,29 +127,6 @@ jobs: echo "job_url=$jobLink" >> $GITHUB_OUTPUT echo "run_url=$runLink" >> $GITHUB_OUTPUT - - name: Clean previous comments - if: ${{ contains(github.event.comment.body, '--clean') }} - uses: actions/github-script@v7 - with: - github-token: ${{ steps.commands_token.outputs.token }} - script: | - github.rest.issues.listComments({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo - }).then(comments => { - for (let comment of comments.data) { - console.log(comment) - console.log(comment.author) - if (comment.body.startsWith('Command') && comment.author.login === 'github-actions[bot]') { - github.rest.issues.deleteComment({ - comment_id: comment.id, - owner: context.repo.owner, - repo: context.repo.repo - }) - } - } - }) - name: Comment PR (Start) if: ${{ !contains(github.event.comment.body, '--quiet') }} @@ -143,9 +152,9 @@ jobs: run: cat .github/env >> $GITHUB_ENV - name: Install Rust - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@master with: - targets: "wasm32-unknown-unknown" + targets: "wasm32-unknown-unknown,x86_64-unknown-linux-musl" components: "rust-src rustfmt clippy" toolchain: "nightly-${{env.RUST_NIGHTLY_VERSION}}"