diff --git a/.github/workflows/daily-grammar-check.yml b/.github/workflows/daily-grammar-check.yml index 88b44eeb87..ef64fad264 100644 --- a/.github/workflows/daily-grammar-check.yml +++ b/.github/workflows/daily-grammar-check.yml @@ -5,20 +5,27 @@ on: - cron: '0 4 * * *' workflow_dispatch: +permissions: {} + jobs: grammar-check: if: github.repository == 'rust-lang/reference' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest + permissions: + issues: write # Required by `gh issue create` to open a new issue. steps: - name: Checkout reference repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Checkout rust-lang/rust (shallow clone) - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: rust-lang/rust path: rust fetch-depth: 1 + persist-credentials: false - name: Update rustup run: rustup self update @@ -63,7 +70,7 @@ jobs: --label "daily-grammar-check" \ --body "The daily grammar check failed on $(date +%Y-%m-%d). - **Workflow Run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + **Workflow Run:** ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} **Command:** \`cargo run --release -p grammar-check -- lex-compare --path rust/tests\` diff --git a/.github/workflows/dev-guide.yml b/.github/workflows/dev-guide.yml index 9a7858d004..b8e6f174a4 100644 --- a/.github/workflows/dev-guide.yml +++ b/.github/workflows/dev-guide.yml @@ -4,6 +4,8 @@ on: branches: - master +permissions: {} + env: MDBOOK_VERSION: 0.5.2 @@ -11,12 +13,14 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: Install mdbook run: | mkdir mdbook - curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${{ env.MDBOOK_VERSION }}/mdbook-v${{ env.MDBOOK_VERSION }}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo `pwd`/mdbook >> $GITHUB_PATH - name: Build the book @@ -28,7 +32,7 @@ jobs: mv book out/dev-guide - name: Upload Artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 with: path: ./dev-guide/out @@ -36,8 +40,8 @@ jobs: needs: build permissions: - pages: write - id-token: write + pages: write # Required by `actions/deploy-pages` to deploy to Pages. + id-token: write # Required by `actions/deploy-pages` to verify the deployment originates from an appropriate source. environment: name: github-pages @@ -46,4 +50,4 @@ jobs: runs-on: ubuntu-latest steps: - id: deployment - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1789e82235..32d0c81b1f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,9 @@ jobs: code-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Update rustup run: rustup self update - name: Install Rust @@ -37,12 +39,15 @@ jobs: style-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Checkout rust-lang/rust - uses: actions/checkout@master + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: rust-lang/rust path: rust + persist-credentials: false - name: Update rustup run: rustup self update - name: Install Rust @@ -80,7 +85,9 @@ jobs: mdbook-spec: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Update rustup run: rustup self update - name: Install Rust @@ -101,7 +108,9 @@ jobs: tools: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Update rustup run: rustup self update - name: Install Rust nightly @@ -122,7 +131,9 @@ jobs: name: dev-guide build check runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install mdbook env: MDBOOK_VERSION: 0.5.1 @@ -139,12 +150,15 @@ jobs: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Checkout rust-lang/rust - uses: actions/checkout@master + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: rust-lang/rust path: rust + persist-credentials: false - name: Update rustup run: rustup self update - name: Install Rust @@ -161,9 +175,10 @@ jobs: env: SPEC_RELATIVE: 0 SPEC_RUST_ROOT: ${{ github.workspace }}/rust - run: mdbook build --dest-dir dist/preview-${{ github.event.pull_request.number }} + GH_PR_NUMBER: ${{ github.event.pull_request.number }} + run: mdbook build --dest-dir dist/preview-${GH_PR_NUMBER} - name: Upload artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: preview-${{ github.event.pull_request.number }} overwrite: true @@ -186,6 +201,8 @@ jobs: # preview is explicitly excluded here since it doesn't run on merge runs-on: ubuntu-latest steps: - - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' + - run: jq --exit-status 'all(.result == "success")' <<< "${JSON_NEEDS}" - name: Done run: exit 0 + env: + JSON_NEEDS: ${{ toJson(needs) }}