Bump actions/github-script from 6 to 7 #35
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
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
pull_request: | |
name: coverage | |
jobs: | |
coverage: | |
runs-on: ubuntu-latest | |
name: ubuntu / nightly / coverage | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install nightly | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: llvm-tools-preview,rust-src | |
- name: cargo install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: cargo generate-lockfile | |
if: hashFiles('Cargo.lock') == '' | |
run: cargo generate-lockfile | |
- name: cargo llvm-cov | |
id: gen-coverage | |
run: | | |
mkdir -p coverage/coverage | |
RUSTFLAGS="--cfg NO_UI_TESTS" cargo llvm-cov --locked --all-features --examples --tests --html | |
mv "target/llvm-cov/html" "coverage/coverage/${{ github.sha }}" | |
- name: Upload to gh-pages | |
run: | | |
cd coverage | |
git config --global init.defaultBranch gh-pages | |
git init | |
git remote add origin "https://github.com/$GITHUB_REPOSITORY" | |
git fetch origin | |
git pull origin gh-pages | |
git config user.name CI | |
git config user.email "" | |
git add . | |
git commit -m "Create coverage of PR #${{ github.event.number }} \`\"${{ github.head_ref }}\"\` (${{ github.sha }})" | |
git push "https://x-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" HEAD:gh-pages | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '[Coverage](https://rust-for-linux.github.io/pinned-init/coverage/${{ github.sha }}) for ${{ github.sha }}' | |
}) |