зеркало из https://github.com/microsoft/STL.git
Update GitHub workflows (#4476)
This commit is contained in:
Родитель
64d9a599da
Коммит
191d51bb56
|
@ -1,35 +0,0 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: Assign New PR
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
branch:
|
||||
- main
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
permissions:
|
||||
repository-projects: write
|
||||
|
||||
jobs:
|
||||
initial-review:
|
||||
if: github.event.pull_request.draft == false
|
||||
runs-on: ubuntu-latest
|
||||
name: Initial Review
|
||||
steps:
|
||||
- name: Assign the New Pull Request
|
||||
uses: srggrs/assign-one-project-github-action@1.3.1
|
||||
with:
|
||||
project: 'https://github.com/microsoft/STL/projects/1'
|
||||
column_name: 'Initial Review'
|
||||
work-in-progress:
|
||||
if: github.event.pull_request.draft == true
|
||||
runs-on: ubuntu-latest
|
||||
name: Work In Progress
|
||||
steps:
|
||||
- name: Assign the New Pull Request
|
||||
uses: srggrs/assign-one-project-github-action@1.3.1
|
||||
with:
|
||||
project: 'https://github.com/microsoft/STL/projects/1'
|
||||
column_name: 'Work In Progress'
|
|
@ -1,68 +0,0 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: Move PR To Initial Review
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
branch:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
move-pr-to-initial-review:
|
||||
if: >
|
||||
github.event.issue.pull_request
|
||||
&& github.event.comment.user.login == github.event.issue.user.login
|
||||
&& contains(github.event.comment.body, '/pr review')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Move To Initial Review
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
// Find "Code Reviews" project manually by name matching
|
||||
// This avoids hardcoding the project ID
|
||||
const projects = await github.paginate(github.rest.projects.listForRepo, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
});
|
||||
const code_reviews = projects.find(project => project.name === 'Code Reviews');
|
||||
if (!code_reviews) {
|
||||
console.error("'Code Reviews' project not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Find "Initial Review" column manually by name matching
|
||||
// This assumes the card is in "Work In Progress" column
|
||||
// This avoids hardcoding the column ID and card ID
|
||||
const columns = await github.paginate(github.rest.projects.listColumns, {
|
||||
project_id: code_reviews.id,
|
||||
});
|
||||
|
||||
const work_in_progress = columns.find(column => column.name === 'Work In Progress');
|
||||
if (!work_in_progress) {
|
||||
console.error("'Work In Progress' column not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
const initial_review = columns.find(column => column.name === 'Initial Review');
|
||||
if (!initial_review) {
|
||||
console.error("'Initial Review' column not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
const pr_card = await github.paginate(github.rest.projects.listCards, {
|
||||
column_id: work_in_progress.id,
|
||||
}).then(cards => cards.find(card => card.content_url === context.payload.issue.url));
|
||||
if (!pr_card) {
|
||||
console.error("Corresponding card for PR not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
github.rest.projects.moveCard({
|
||||
card_id: pr_card.id,
|
||||
position: 'bottom',
|
||||
column_id: initial_review.id,
|
||||
}).catch(error => {
|
||||
console.error(`Error occurred while moving card to 'Initial Review': ${error}`);
|
||||
});
|
|
@ -1,73 +0,0 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: Move PR To Work In Progress
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
branch:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
move-pr-to-wip:
|
||||
if: >
|
||||
github.event.issue.pull_request
|
||||
&& github.event.comment.user.login == github.event.issue.user.login
|
||||
&& contains(github.event.comment.body, '/pr wip')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Move To Work In Progress
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
// Find "Code Reviews" project manually by name matching
|
||||
// This avoids hardcoding the project ID
|
||||
const projects = await github.paginate(github.rest.projects.listForRepo, {
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
});
|
||||
const code_reviews = projects.find(project => project.name === 'Code Reviews');
|
||||
if (!code_reviews) {
|
||||
console.error("'Code Reviews' project not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Find "Work In Progress" column manually by name matching
|
||||
// Also find the card of the PR in either "Initial Review" or "Final Review"
|
||||
// This avoids hardcoding the column ID and card ID
|
||||
const columns = await github.paginate(github.rest.projects.listColumns, {
|
||||
project_id: code_reviews.id,
|
||||
});
|
||||
|
||||
const work_in_progress = columns.find(column => column.name === 'Work In Progress');
|
||||
if (!work_in_progress) {
|
||||
console.error("'Work In Progress' column not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
const move_card_in_column = async (column) => {
|
||||
const cards = await github.paginate(github.rest.projects.listCards, {
|
||||
column_id: column.id,
|
||||
});
|
||||
|
||||
const pr_card = cards.find(card => card.content_url === context.payload.issue.url);
|
||||
if (!pr_card) {
|
||||
return; // the PR card is not in this column
|
||||
}
|
||||
|
||||
await github.rest.projects.moveCard({
|
||||
card_id: pr_card.id,
|
||||
position: 'bottom',
|
||||
column_id: work_in_progress.id,
|
||||
});
|
||||
};
|
||||
|
||||
columns.forEach(column => {
|
||||
if (column.name !== 'Initial Review' && column.name !== 'Final Review') {
|
||||
return; // no reason to search through other columns and avoids unnecessary API calls
|
||||
}
|
||||
|
||||
move_card_in_column(column).catch(error => {
|
||||
console.error(`Error occurred while moving card to 'Work In Progress': ${error}`);
|
||||
});
|
||||
});
|
|
@ -20,20 +20,20 @@ jobs:
|
|||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ">=21.4.0"
|
||||
node-version: ">=21.7.1"
|
||||
- name: Install Packages
|
||||
run: |
|
||||
npm ci
|
||||
- name: Compile And Run gather_stats.ts
|
||||
- name: Compile And Run gather_stats.mts
|
||||
run: |
|
||||
SECRET_GITHUB_PERSONAL_ACCESS_TOKEN="${{ github.token }}" npm run gather
|
||||
- name: Compile And Bundle status_chart.ts
|
||||
- name: Compile And Bundle status_chart.mts
|
||||
run: |
|
||||
npm run make
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add src/daily_table.ts src/monthly_table.ts built/status_chart.mjs
|
||||
git add src/daily_table.mts src/monthly_table.mts built/status_chart.mjs
|
||||
git diff-index --quiet HEAD || git commit -m "Automated update."
|
||||
git push origin gh-pages
|
||||
|
|
Загрузка…
Ссылка в новой задаче