mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-11-09 16:18:34 +01:00
workflows/bot: rename from labels
This workflow / script is already doing more than must labeling: it's already auto-closing package request issues. Since we're going to migrate the nixpkgs-merge-bot into this workflow, we'll rename things to a more generic name.
This commit is contained in:
parent
75119422cf
commit
d78de15627
2
.github/labeler-development-branches.yml
vendored
2
.github/labeler-development-branches.yml
vendored
|
|
@ -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.
|
# This version is only run for Pull Requests from development branches like staging-next, haskell-updates or python-updates.
|
||||||
|
|
||||||
"4.workflow: package set update":
|
"4.workflow: package set update":
|
||||||
|
|
|
||||||
2
.github/labeler-no-sync.yml
vendored
2
.github/labeler-no-sync.yml
vendored
|
|
@ -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
|
# 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
|
# keep-sorted start case=no numeric=yes newline_separated=yes skip_lines=1
|
||||||
|
|
|
||||||
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
|
|
@ -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
|
# 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
|
# keep-sorted start case=no numeric=yes newline_separated=yes skip_lines=1
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
# access to the GitHub API. This means that it should not evaluate user input in
|
# access to the GitHub API. This means that it should not evaluate user input in
|
||||||
# a way that allows code injection.
|
# a way that allows code injection.
|
||||||
|
|
||||||
name: Labels
|
name: Bot
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
|
|
@ -21,7 +21,7 @@ on:
|
||||||
concurrency:
|
concurrency:
|
||||||
# This explicitly avoids using `run_id` for the concurrency key to make sure that only
|
# This explicitly avoids using `run_id` for the concurrency key to make sure that only
|
||||||
# *one* scheduled run can run at a time.
|
# *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.
|
# PR-triggered runs will be cancelled, but scheduled runs will be queued.
|
||||||
cancel-in-progress: ${{ github.event_name != 'schedule' }}
|
cancel-in-progress: ${{ github.event_name != 'schedule' }}
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ defaults:
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
run:
|
||||||
runs-on: ubuntu-24.04-arm
|
runs-on: ubuntu-24.04-arm
|
||||||
if: github.event_name != 'schedule' || github.repository_owner == 'NixOS'
|
if: github.event_name != 'schedule' || github.repository_owner == 'NixOS'
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -64,13 +64,13 @@ jobs:
|
||||||
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }}
|
||||||
run: gh api /rate_limit | jq
|
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
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
|
||||||
with:
|
with:
|
||||||
github-token: ${{ steps.app-token.outputs.token || github.token }}
|
github-token: ${{ steps.app-token.outputs.token || github.token }}
|
||||||
retries: 3
|
retries: 3
|
||||||
script: |
|
script: |
|
||||||
require('./ci/github-script/labels.js')({
|
require('./ci/github-script/bot.js')({
|
||||||
github,
|
github,
|
||||||
context,
|
context,
|
||||||
core,
|
core,
|
||||||
6
.github/workflows/pull-request-target.yml
vendored
6
.github/workflows/pull-request-target.yml
vendored
|
|
@ -100,10 +100,10 @@ jobs:
|
||||||
systems: ${{ needs.prepare.outputs.systems }}
|
systems: ${{ needs.prepare.outputs.systems }}
|
||||||
testVersions: ${{ contains(fromJSON(needs.prepare.outputs.touched), 'pinned') && !contains(fromJSON(needs.prepare.outputs.headBranch).type, 'development') }}
|
testVersions: ${{ contains(fromJSON(needs.prepare.outputs.touched), 'pinned') && !contains(fromJSON(needs.prepare.outputs.headBranch).type, 'development') }}
|
||||||
|
|
||||||
labels:
|
bot:
|
||||||
name: Labels
|
name: Bot
|
||||||
needs: [prepare, eval]
|
needs: [prepare, eval]
|
||||||
uses: ./.github/workflows/labels.yml
|
uses: ./.github/workflows/bot.yml
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
|
||||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
|
@ -58,10 +58,10 @@ jobs:
|
||||||
|
|
||||||
if (files.some(file => [
|
if (files.some(file => [
|
||||||
'.github/actions/checkout/action.yml',
|
'.github/actions/checkout/action.yml',
|
||||||
|
'.github/workflows/bot.yml',
|
||||||
'.github/workflows/build.yml',
|
'.github/workflows/build.yml',
|
||||||
'.github/workflows/check.yml',
|
'.github/workflows/check.yml',
|
||||||
'.github/workflows/eval.yml',
|
'.github/workflows/eval.yml',
|
||||||
'.github/workflows/labels.yml',
|
|
||||||
'.github/workflows/lint.yml',
|
'.github/workflows/lint.yml',
|
||||||
'.github/workflows/pull-request-target.yml',
|
'.github/workflows/pull-request-target.yml',
|
||||||
'.github/workflows/reviewers.yml',
|
'.github/workflows/reviewers.yml',
|
||||||
|
|
|
||||||
|
|
@ -484,7 +484,7 @@ module.exports = async ({ github, context, core, dry }) => {
|
||||||
const lastRun = (
|
const lastRun = (
|
||||||
await github.rest.actions.listWorkflowRuns({
|
await github.rest.actions.listWorkflowRuns({
|
||||||
...context.repo,
|
...context.repo,
|
||||||
workflow_id: 'labels.yml',
|
workflow_id: 'bot.yml',
|
||||||
event: 'schedule',
|
event: 'schedule',
|
||||||
status: 'success',
|
status: 'success',
|
||||||
exclude_pull_requests: true,
|
exclude_pull_requests: true,
|
||||||
|
|
@ -65,19 +65,19 @@ program
|
||||||
})
|
})
|
||||||
|
|
||||||
program
|
program
|
||||||
.command('labels')
|
.command('bot')
|
||||||
.description('Manage labels on pull requests.')
|
.description('Run automation on pull requests and issues.')
|
||||||
.argument('<owner>', 'Owner of the GitHub repository to label (Example: NixOS)')
|
.argument('<owner>', 'Owner of the GitHub repository to label (Example: NixOS)')
|
||||||
.argument('<repo>', 'Name of the GitHub repository to label (Example: nixpkgs)')
|
.argument('<repo>', 'Name of the GitHub repository to label (Example: nixpkgs)')
|
||||||
.argument('[pr]', 'Number of the Pull Request to label')
|
.argument('[pr]', 'Number of the Pull Request to label')
|
||||||
.option('--no-dry', 'Make actual modifications')
|
.option('--no-dry', 'Make actual modifications')
|
||||||
.action(async (owner, repo, pr, options) => {
|
.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-'))
|
const tmp = mkdtempSync(join(tmpdir(), 'github-script-'))
|
||||||
try {
|
try {
|
||||||
process.env.GITHUB_WORKSPACE = tmp
|
process.env.GITHUB_WORKSPACE = tmp
|
||||||
process.chdir(tmp)
|
process.chdir(tmp)
|
||||||
await run(labels, owner, repo, pr, options)
|
await run(bot, owner, repo, pr, options)
|
||||||
} finally {
|
} finally {
|
||||||
rmSync(tmp, { recursive: true })
|
rmSync(tmp, { recursive: true })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue