about summary refs log tree commit diff
path: root/nixpkgs/.github/workflows
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
commite0794be8a0d11e90461e5a9c85012a36b93ec976 (patch)
treeefd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/.github/workflows
parent3538874082ded7647b1ccec0343c7c1e882cfef3 (diff)
parent1a57d96edd156958b12782e8c8b6a374142a7248 (diff)
downloadnixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/.github/workflows')
-rw-r--r--nixpkgs/.github/workflows/editorconfig.yml26
-rw-r--r--nixpkgs/.github/workflows/manual-nixos.yml28
-rw-r--r--nixpkgs/.github/workflows/manual-nixpkgs.yml28
-rw-r--r--nixpkgs/.github/workflows/merge-staging.yml39
-rw-r--r--nixpkgs/.github/workflows/rebase-staging.yml60
5 files changed, 173 insertions, 8 deletions
diff --git a/nixpkgs/.github/workflows/editorconfig.yml b/nixpkgs/.github/workflows/editorconfig.yml
index 98c7afbab780..6935d0bbd21f 100644
--- a/nixpkgs/.github/workflows/editorconfig.yml
+++ b/nixpkgs/.github/workflows/editorconfig.yml
@@ -2,26 +2,36 @@ name: "Checking EditorConfig"
 
 on:
   pull_request:
+    branches-ignore:
+      - 'release-**'
 
 jobs:
   tests:
     runs-on: ubuntu-latest
+    if: github.repository_owner == 'NixOS'
     steps:
+    - name: Get list of changed files from PR
+      env:
+        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      run: |
+        echo 'PR_DIFF<<EOF' >> $GITHUB_ENV
+        gh api \
+          repos/NixOS/nixpkgs/pulls/${{github.event.number}}/files --paginate \
+          | jq '.[] | select(.status != "removed") | .filename' \
+          >> $GITHUB_ENV
+        echo 'EOF' >> $GITHUB_ENV
     - uses: actions/checkout@v2
-      with:
-        fetch-depth: 0
-    - uses: technote-space/get-diff-action@v3.1.0
+      if: env.PR_DIFF
     - name: Fetch editorconfig-checker
-      if: env.GIT_DIFF
+      if: env.PR_DIFF
       env:
-        ECC_VERSION: "2.1.0"
+        ECC_VERSION: "2.2.0"
         ECC_URL: "https://github.com/editorconfig-checker/editorconfig-checker/releases/download"
       run: |
         curl -sSf -O -L -C - "$ECC_URL/$ECC_VERSION/ec-linux-amd64.tar.gz" && \
         tar xzf ec-linux-amd64.tar.gz && \
         mv ./bin/ec-linux-amd64 ./bin/editorconfig-checker
     - name: Checking EditorConfig
-      if: env.GIT_DIFF
+      if: env.PR_DIFF
       run: |
-        ./bin/editorconfig-checker -disable-indentation \
-        ${{ env.GIT_DIFF }}
+        echo "$PR_DIFF" | xargs ./bin/editorconfig-checker -disable-indent-size
diff --git a/nixpkgs/.github/workflows/manual-nixos.yml b/nixpkgs/.github/workflows/manual-nixos.yml
new file mode 100644
index 000000000000..a75e84029301
--- /dev/null
+++ b/nixpkgs/.github/workflows/manual-nixos.yml
@@ -0,0 +1,28 @@
+name: "Build NixOS manual"
+
+on:
+  pull_request_target:
+    branches:
+      - master
+    paths:
+      - 'nixos/**'
+
+jobs:
+  nixos:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          # pull_request_target checks out the base branch by default
+          ref: refs/pull/${{ github.event.pull_request.number }}/merge
+      - uses: cachix/install-nix-action@v12
+        with:
+          # explicitly enable sandbox
+          extra_nix_config: sandbox = true
+      - uses: cachix/cachix-action@v8
+        with:
+          # This cache is for the nixos/nixpkgs manual builds and should not be trusted or used elsewhere.
+          name: nixpkgs-ci
+          signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
+      - name: Building NixOS manual
+        run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true nixos/release.nix -A manual.x86_64-linux
diff --git a/nixpkgs/.github/workflows/manual-nixpkgs.yml b/nixpkgs/.github/workflows/manual-nixpkgs.yml
new file mode 100644
index 000000000000..7596719d9b50
--- /dev/null
+++ b/nixpkgs/.github/workflows/manual-nixpkgs.yml
@@ -0,0 +1,28 @@
+name: "Build Nixpkgs manual"
+
+on:
+  pull_request_target:
+    branches:
+      - master
+    paths:
+      - 'doc/**'
+
+jobs:
+  nixpkgs:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          # pull_request_target checks out the base branch by default
+          ref: refs/pull/${{ github.event.pull_request.number }}/merge
+      - uses: cachix/install-nix-action@v12
+        with:
+          # explicitly enable sandbox
+          extra_nix_config: sandbox = true
+      - uses: cachix/cachix-action@v8
+        with:
+          # This cache is for the nixos/nixpkgs manual builds and should not be trusted or used elsewhere.
+          name: nixpkgs-ci
+          signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
+      - name: Building Nixpkgs manual
+        run: NIX_PATH=nixpkgs=$(pwd) nix-build --option restrict-eval true pkgs/top-level/release.nix -A manual
diff --git a/nixpkgs/.github/workflows/merge-staging.yml b/nixpkgs/.github/workflows/merge-staging.yml
new file mode 100644
index 000000000000..1aadef16328a
--- /dev/null
+++ b/nixpkgs/.github/workflows/merge-staging.yml
@@ -0,0 +1,39 @@
+name: "merge staging(-next)"
+
+on:
+  schedule:
+    # * is a special character in YAML so you have to quote this string
+    # Merge every 6 hours
+    - cron:  '0 */6 * * *'
+
+jobs:
+  sync-branch:
+    if: github.repository == 'NixOS/nixpkgs'
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Merge master into staging-next
+        uses: devmasx/merge-branch@v1.3.1
+        with:
+          type: now
+          from_branch: master
+          target_branch: staging-next
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Merge staging-next into staging
+        uses: devmasx/merge-branch@v1.3.1
+        with:
+          type: now
+          from_branch: staging-next
+          target_branch: staging
+          github_token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Comment on failure
+        uses: peter-evans/create-or-update-comment@v1
+        if: ${{ failure() }}
+        with:
+          issue-number: 105153
+          body: |
+            An automatic merge [failed](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }}).
+
diff --git a/nixpkgs/.github/workflows/rebase-staging.yml b/nixpkgs/.github/workflows/rebase-staging.yml
new file mode 100644
index 000000000000..41b06f95668a
--- /dev/null
+++ b/nixpkgs/.github/workflows/rebase-staging.yml
@@ -0,0 +1,60 @@
+on:
+  issue_comment:
+    types:
+      - created
+
+# This action allows people with write access to the repo to rebase a PRs base branch from
+# master to staging by commenting `/rebase-staging` on the PR while avoiding CODEOWNER notifications.
+
+jobs:
+  rebase:
+    runs-on: ubuntu-latest
+    if: github.repository_owner == 'NixOS' && github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase-staging')
+    steps:
+      - uses: peter-evans/create-or-update-comment@v1
+        with:
+          comment-id: ${{ github.event.comment.id }}
+          reactions: eyes
+      - uses: scherermichael-oss/action-has-permission@1.0.6
+        id: check-write-access
+        with:
+          required-permission: write
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: check base branch is master
+        if: steps.check-write-access.outputs.has-permission
+        run: |
+          if [ "$(curl https://api.github.com/repos/NixOS/nixpkgs/pulls/${{ github.event.issue.number }} | jq -r '.base.ref')" != "master" ]; then
+            echo "This action only works when the current base branch is master."
+            exit 1
+          fi
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
+        if: steps.check-write-access.outputs.has-permission
+      - name: rebase pull request
+        if: steps.check-write-access.outputs.has-permission
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          PULL_REQUEST: ${{ github.event.issue.number }}
+        run: |
+          git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
+          git config --global user.name "github-actions[bot]"
+          git fetch origin
+          gh pr checkout "$PULL_REQUEST"
+          git rebase \
+            --onto="$(git merge-base origin/master origin/staging)" \
+            "HEAD~$(git rev-list --count HEAD ^master)"
+          git push --force
+          curl \
+            -X POST \
+            -H "Accept: application/vnd.github.v3+json" \
+            -H "Authorization: token $GITHUB_TOKEN" \
+            -d '{ "base": "staging" }' \
+            "https://api.github.com/repos/NixOS/nixpkgs/pulls/$PULL_REQUEST"
+      - uses: peter-evans/create-or-update-comment@v1
+        if: ${{ failure() }}
+        with:
+          issue-number: ${{ github.event.issue.number }}
+          body: |
+            [Failed to rebase on `staging`](https://github.com/NixOS/nixpkgs/actions/runs/${{ github.run_id }})