diff --git a/.github/labeler-development-branches.yml b/.github/labeler-development-branches.yml index 5ce799c2f8d4..bb1c47a23fa0 100644 --- a/.github/labeler-development-branches.yml +++ b/.github/labeler-development-branches.yml @@ -1,4 +1,4 @@ -# This file is used by .github/workflows/labels.yml +# This file is used by .github/workflows/bot.yml # This version is only run for Pull Requests from development branches like staging-next, haskell-updates or python-updates. "4.workflow: package set update": diff --git a/.github/labeler-no-sync.yml b/.github/labeler-no-sync.yml index 69249f6ac27d..99d1b85c3c7b 100644 --- a/.github/labeler-no-sync.yml +++ b/.github/labeler-no-sync.yml @@ -1,4 +1,4 @@ -# This file is used by .github/workflows/labels.yml +# This file is used by .github/workflows/bot.yml # This version uses `sync-labels: false`, meaning that a non-match will NOT remove the label # keep-sorted start case=no numeric=yes newline_separated=yes skip_lines=1 diff --git a/.github/labeler.yml b/.github/labeler.yml index adfc49ef6ee2..abec7c37288c 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,4 +1,4 @@ -# This file is used by .github/workflows/labels.yml +# This file is used by .github/workflows/bot.yml # This version uses `sync-labels: true`, meaning that a non-match will remove the label # keep-sorted start case=no numeric=yes newline_separated=yes skip_lines=1 diff --git a/.github/workflows/labels.yml b/.github/workflows/bot.yml similarity index 94% rename from .github/workflows/labels.yml rename to .github/workflows/bot.yml index e3dfe2642e50..1fbef1134f14 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/bot.yml @@ -3,7 +3,7 @@ # access to the GitHub API. This means that it should not evaluate user input in # a way that allows code injection. -name: Labels +name: Bot on: schedule: @@ -21,7 +21,7 @@ on: concurrency: # This explicitly avoids using `run_id` for the concurrency key to make sure that only # *one* scheduled run can run at a time. - group: labels-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }} + group: bot-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }} # PR-triggered runs will be cancelled, but scheduled runs will be queued. cancel-in-progress: ${{ github.event_name != 'schedule' }} @@ -36,7 +36,7 @@ defaults: shell: bash jobs: - update: + run: runs-on: ubuntu-24.04-arm if: github.event_name != 'schedule' || github.repository_owner == 'NixOS' steps: @@ -64,13 +64,13 @@ jobs: GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }} run: gh api /rate_limit | jq - - name: Labels from API data and Eval results + - name: Run bot uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: github-token: ${{ steps.app-token.outputs.token || github.token }} retries: 3 script: | - require('./ci/github-script/labels.js')({ + require('./ci/github-script/bot.js')({ github, context, core, diff --git a/.github/workflows/pull-request-target.yml b/.github/workflows/pull-request-target.yml index 8a305a953933..d73f6fdc7e5c 100644 --- a/.github/workflows/pull-request-target.yml +++ b/.github/workflows/pull-request-target.yml @@ -100,10 +100,10 @@ jobs: systems: ${{ needs.prepare.outputs.systems }} testVersions: ${{ contains(fromJSON(needs.prepare.outputs.touched), 'pinned') && !contains(fromJSON(needs.prepare.outputs.headBranch).type, 'development') }} - labels: - name: Labels + bot: + name: Bot needs: [prepare, eval] - uses: ./.github/workflows/labels.yml + uses: ./.github/workflows/bot.yml permissions: issues: write pull-requests: write diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b26f7ee98998..f938ea5f64b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,10 +58,10 @@ jobs: if (files.some(file => [ '.github/actions/checkout/action.yml', + '.github/workflows/bot.yml', '.github/workflows/build.yml', '.github/workflows/check.yml', '.github/workflows/eval.yml', - '.github/workflows/labels.yml', '.github/workflows/lint.yml', '.github/workflows/pull-request-target.yml', '.github/workflows/reviewers.yml', diff --git a/ci/github-script/labels.js b/ci/github-script/bot.js similarity index 99% rename from ci/github-script/labels.js rename to ci/github-script/bot.js index bd6c81bd9d99..807b134843dc 100644 --- a/ci/github-script/labels.js +++ b/ci/github-script/bot.js @@ -484,7 +484,7 @@ module.exports = async ({ github, context, core, dry }) => { const lastRun = ( await github.rest.actions.listWorkflowRuns({ ...context.repo, - workflow_id: 'labels.yml', + workflow_id: 'bot.yml', event: 'schedule', status: 'success', exclude_pull_requests: true, diff --git a/ci/github-script/run b/ci/github-script/run index 782e3fa7db1f..8a2906606cac 100755 --- a/ci/github-script/run +++ b/ci/github-script/run @@ -65,19 +65,19 @@ program }) program - .command('labels') - .description('Manage labels on pull requests.') + .command('bot') + .description('Run automation on pull requests and issues.') .argument('', 'Owner of the GitHub repository to label (Example: NixOS)') .argument('', 'Name of the GitHub repository to label (Example: nixpkgs)') .argument('[pr]', 'Number of the Pull Request to label') .option('--no-dry', 'Make actual modifications') .action(async (owner, repo, pr, options) => { - const labels = (await import('./labels.js')).default + const bot = (await import('./bot.js')).default const tmp = mkdtempSync(join(tmpdir(), 'github-script-')) try { process.env.GITHUB_WORKSPACE = tmp process.chdir(tmp) - await run(labels, owner, repo, pr, options) + await run(bot, owner, repo, pr, options) } finally { rmSync(tmp, { recursive: true }) }