Skip to content

Commit

Permalink
build: harden bors.yml permissions
Browse files Browse the repository at this point in the history
Signed-off-by: Alex <aleksandrosansan@gmail.com>
  • Loading branch information
sashashura committed Sep 26, 2022
1 parent 872dfea commit af57445
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/bors.yml
Expand Up @@ -6,8 +6,13 @@ on:
- auto-libc
- try

permissions: {}
jobs:
docker_linux_tier1:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Docker Linux Tier1
runs-on: ubuntu-22.04
strategy:
Expand All @@ -28,6 +33,10 @@ jobs:
run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }}

macos:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: macOS
runs-on: macos-12
strategy:
Expand All @@ -47,6 +56,10 @@ jobs:
run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }}

windows:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Windows
runs-on: windows-2022
env:
Expand Down Expand Up @@ -83,6 +96,10 @@ jobs:
shell: bash

style_check:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Style check
runs-on: ubuntu-22.04
steps:
Expand All @@ -96,6 +113,10 @@ jobs:
run: sh ci/style.sh

docker_linux_tier2:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Docker Linux Tier2
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -154,6 +175,10 @@ jobs:
# These targets are tier 3 or otherwise need to have CI build std via -Zbuild-std.
# Because of this, only the nightly compiler can be used on these targets.
docker_linux_build_std:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

if: ${{ false }} # This is currently broken
name: Docker Linux Build-Std Targets
needs: [docker_linux_tier1, style_check]
Expand All @@ -177,6 +202,10 @@ jobs:

# devkitpro's pacman needs to be connected from Docker.
docker_switch:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Docker Switch
needs: [docker_linux_tier1, style_check]
runs-on: ubuntu-22.04
Expand All @@ -191,6 +220,10 @@ jobs:
run: LIBC_CI=1 sh ./ci/run-docker.sh switch

build_channels_linux:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Build Channels Linux
needs: docker_linux_tier2
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -221,6 +254,10 @@ jobs:
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh

build_channels_macos:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Build Channels macOS
needs: macos
runs-on: macos-12
Expand Down Expand Up @@ -251,6 +288,9 @@ jobs:
run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh

build_channels_windows:
permissions:
contents: read # to fetch code (actions/checkout)

name: Build Channels Windows
runs-on: windows-2022
env:
Expand All @@ -275,6 +315,9 @@ jobs:
shell: bash

semver_linux:
permissions:
contents: read # to fetch code (actions/checkout)

if: ${{ false }} # This is currently broken
name: Semver Linux
runs-on: ubuntu-22.04
Expand All @@ -288,6 +331,9 @@ jobs:
run: sh ci/semver.sh linux

semver_macos:
permissions:
contents: read # to fetch code (actions/checkout)

if: ${{ false }} # This is currently broken
name: Semver macOS
runs-on: macos-12
Expand All @@ -301,6 +347,10 @@ jobs:
run: sh ci/semver.sh macos

docs:
permissions:
actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds)
contents: read # to fetch code (actions/checkout)

name: Generate documentation
runs-on: ubuntu-22.04
needs: docker_linux_tier2
Expand Down

0 comments on commit af57445

Please sign in to comment.