Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions .github/workflows/issue-regression-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,29 @@ jobs:
permissions:
issues: write
steps:
- name: Fetch template body
id: check_regression
uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEMPLATE_BODY: ${{ github.event.issue.body }}
- name: Check and manage regression label
uses: actions/github-script@v9
with:
script: |
const body = context.payload.issue.body || '';
const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i;
const template = `${process.env.TEMPLATE_BODY}`
const match = regressionPattern.test(template);
core.setOutput('is_regression', match);
- name: Manage regression label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
else
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}
fi
const isRegression = regressionPattern.test(body);
const issueNumber = context.payload.issue.number;

if (isRegression) {
await github.rest.issues.addLabels({
...context.repo,
issue_number: issueNumber,
labels: ['potential-regression'],
});
} else {
try {
await github.rest.issues.removeLabel({
...context.repo,
issue_number: issueNumber,
name: 'potential-regression',
});
} catch (e) {
if (e.status !== 404) throw e;
}
}
84 changes: 56 additions & 28 deletions .github/workflows/slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,53 +19,81 @@ jobs:
if: github.event_name == 'issues' && github.event.action == 'opened'
steps:
- name: notify
uses: actions/github-script@v9
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"type": "issues_opened", "id": "${{ github.event.issue.number }}", "title": "'"$ISSUE_TITLE"'"}' \
${{ secrets.CI_SLACK_WEBHOOK_URL }}
WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}
with:
script: |
const resp = await fetch(process.env.WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'issues_opened',
id: String(context.payload.issue.number),
title: context.payload.issue.title,
}),
});
if (!resp.ok) core.setFailed(`Slack webhook returned ${resp.status}`);

on-issue-closed:
runs-on: ubuntu-latest
if: github.event_name == 'issues' && github.event.action == 'closed'
steps:
- name: notify
uses: actions/github-script@v9
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"type": "issues_closed", "id": "${{ github.event.issue.number }}", "title": "'"$ISSUE_TITLE"'"}' \
${{ secrets.CI_SLACK_WEBHOOK_URL }}
WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}
with:
script: |
const resp = await fetch(process.env.WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'issues_closed',
id: String(context.payload.issue.number),
title: context.payload.issue.title,
}),
});
if (!resp.ok) core.setFailed(`Slack webhook returned ${resp.status}`);

on-pr-opened:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'opened'
steps:
- name: notify
uses: actions/github-script@v9
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"type": "pullrequest_opened", "id": "${{ github.event.pull_request.number }}", "title": "'"$PR_TITLE"'"}' \
${{ secrets.CI_SLACK_WEBHOOK_URL }}
WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}
with:
script: |
const resp = await fetch(process.env.WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'pullrequest_opened',
id: String(context.payload.pull_request.number),
title: context.payload.pull_request.title,
}),
});
if (!resp.ok) core.setFailed(`Slack webhook returned ${resp.status}`);

on-pr-closed:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed'
steps:
- name: notify
uses: actions/github-script@v9
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
curl \
-X POST \
-H 'Content-Type: application/json' \
-d '{"type": "pullrequest_closed", "id": "${{ github.event.pull_request.number }}", "title": "'"$PR_TITLE"'"}' \
${{ secrets.CI_SLACK_WEBHOOK_URL }}
WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}
with:
script: |
const resp = await fetch(process.env.WEBHOOK_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
type: 'pullrequest_closed',
id: String(context.payload.pull_request.number),
title: context.payload.pull_request.title,
}),
});
if (!resp.ok) core.setFailed(`Slack webhook returned ${resp.status}`);
Loading