Skip to content
Merged
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
444 changes: 3 additions & 441 deletions .github/workflows/auto-assign.yml

Large diffs are not rendered by default.

40 changes: 2 additions & 38 deletions .github/workflows/issue-assigned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,8 @@
name: Issue Assignment Workflow
on:
issues:
types: ['assigned']
permissions:
contents: read
issues: write
types: ['assigned']

jobs:
Remove-Unapproved-Label:
name: Remove Unapproved Label when issue is assigned
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const apiParams = {
owner,
repo,
issue_number
};

// Get current labels on the issue
const { data: labelList } = await github.rest.issues.listLabelsOnIssue(apiParams);
const unapprovedLabel = labelList.find(l =>
l.name.toLowerCase().includes('unapprov') // matches 'unapproved' too
);

// Remove unapproved label if it exists
if (unapprovedLabel) {

try {
await github.rest.issues.removeLabel({
owner,
repo,
issue_number,
name: unapprovedLabel.name,
});
} catch (err) {
if (err.status !== 404) throw err;
}
}
uses: PalisadoesFoundation/.github/.github/workflows/issue-assigned.yml@main
47 changes: 3 additions & 44 deletions .github/workflows/issue-unassigned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,6 @@ on:

jobs:
add-unapproved-label:
runs-on: ubuntu-latest

permissions:
issues: write
contents: read

steps:
- name: Add unapproved label
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;

try {
// Get the complete issue object (includes ALL labels, no pagination issues)
const { data: issue } = await github.rest.issues.get({
owner,
repo,
issue_number
});

// Check if the issue already has the 'unapproved' label (exact match)
const hasUnapprovedLabel = issue.labels.some(
label => label.name === 'unapproved'
);

// Only add if it doesn't already have the label
if (!hasUnapprovedLabel) {
await github.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: ['unapproved']
});

console.log(`Added 'unapproved' label to issue #${issue_number}`);
} else {
console.log(`Issue #${issue_number} already has 'unapproved' label - skipping`);
}
} catch (error) {
console.error(`Error processing issue #${issue_number}:`, error.message);
throw error; // Re-throw to fail the workflow and alert maintainers
}
uses: PalisadoesFoundation/.github/.github/workflows/issue-unassigned.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 4 additions & 50 deletions .github/workflows/issue.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,9 @@
##############################################################################
##############################################################################
#
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
#
##############################################################################
##############################################################################

name: Issue Workflow
on:
issues:
types: ['opened']
jobs:
Opened-issue-label:
name: Adding Issue Label
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
.github/workflows/auto-label.json5
sparse-checkout-cone-mode: false
- uses: Renato66/auto-label@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const apiParams = {
owner,
repo,
issue_number
};
const labels = await github.rest.issues.listLabelsOnIssue(apiParams);
if(labels.data.reduce((a, c)=>a||["dependencies"].includes(c.name), false))
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["good first issue", "security"]
});
else if(labels.data.reduce((a, c)=>a||["security", "ui/ux", "test", "ci/cd"].includes(c.name), false))
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ["good first issue"]
});
Opened-issue-label:
uses: PalisadoesFoundation/.github/.github/workflows/issue.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 1 addition & 44 deletions .github/workflows/pull-request-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,4 @@ on:

jobs:
Check-CodeRabbit-Approval:
name: Check CodeRabbit Approval
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
- name: Sleep for 30 seconds to make sure the review status propagates
run: sleep 30s
shell: bash
- name: Check CodeRabbit approval using GitHub Script
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// List all reviews for the PR
const { data: reviews } = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});

// Filter reviews that have a user login containing "coderabbit" (case-insensitive)
// and exclude COMMENTED states.
const codeRabbitReviews = reviews.filter(review =>
(review.user.login.toLowerCase().includes('coderabbit') ||
review.user.login.toLowerCase().includes('coderabbitai')) &&
review.state !== 'COMMENTED'
);

// Fail if no CodeRabbit reviews are found
if (codeRabbitReviews.length === 0) {
core.setFailed('ERROR: CodeRabbit has not reviewed this PR.');
return;
}

// Sort reviews by submitted_at date in descending order
codeRabbitReviews.sort((a, b) => new Date(b.submitted_at) - new Date(a.submitted_at));
const latestReview = codeRabbitReviews[0];

// Fail if the latest review from CodeRabbit is not "APPROVED"
if (latestReview.state !== 'APPROVED') {
core.setFailed('ERROR: CodeRabbit approval is required before merging this PR.');
} else {
console.log('Success: CodeRabbit has approved this PR.');
}
uses: PalisadoesFoundation/.github/.github/workflows/pull-request-review.yml@main
62 changes: 4 additions & 58 deletions .github/workflows/pull-request-target.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,10 @@
##############################################################################
##############################################################################
#
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
#
##############################################################################
##############################################################################

name: PR Target Workflow

on:
pull_request_target:

# Required for arkid15r/check-pr-issue-action
permissions:
contents: read
issues: read
pull-requests: write

jobs:
PR-Greeting:
name: Pull Request Greeting
runs-on: ubuntu-latest
steps:
- name: Add the PR Review Policy
uses: thollander/actions-comment-pull-request@v3
with:
comment-tag: pr_review_policy
message: |
## Our Pull Request Approval Process

This PR will be reviewed according to our:

1. [Palisadoes Contributing Guidelines](https://developer.palisadoes.org/docs/contributor-guide/contributing)

2. [AI Usage Policy](https://developer.palisadoes.org/docs/contributor-guide/ai)

Your PR may be automatically closed if:

1. Our PR template isn't filled in correctly

1. [You haven't correctly linked your PR to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue)

Thanks for contributing!

Check-PR-Issue:
name: Check Correct PR Issue Assignment
runs-on: ubuntu-latest
needs: [PR-Greeting]
steps:
- uses: actions/checkout@v4
- name: Check PR linked issue and assignee
uses: arkid15r/check-pr-issue-action@0.1.3
with:
close_pr_on_failure: 'true'
github_token: ${{ secrets.GITHUB_TOKEN }}
no_assignee_message: 'The linked issue must be assigned to the PR author.'
no_issue_message: 'The PR must be linked to an issue assigned to the PR author.'
check_issue_reference: 'true'
require_assignee: 'true'
# List of usernames who can create PRs without having an assigned issue
skip_users_file_path: '.github/workflows/config/check-pr-issue-skip-usernames.txt'
uses: PalisadoesFoundation/.github/.github/workflows/pr-target-policy.yml@main
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 2 additions & 36 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,8 @@
##############################################################################
##############################################################################
#
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
#
##############################################################################
##############################################################################

name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 0 * * *"

permissions:
issues: write
pull-requests: write

- cron: "*/20 0 * * *"
jobs:
stale:
name: Process Stale Issues and PRs
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.'
stale-pr-message: 'This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.'
close-issue-message: 'This issue did not get any activity in the past 180 days and thus has been closed. Please check if the newest release or develop branch has it fixed. Please, create a new issue if the issue is not fixed.'
close-pr-message: 'This pull request did not get any activity in the past 180 days and thus has been closed.'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
days-before-stale: 7
days-before-close: 180
remove-stale-when-updated: true
exempt-all-milestones: true
exempt-pr-labels: 'wip'
exempt-issue-labels: 'wip'
operations-per-run: 30
uses: PalisadoesFoundation/.github/.github/workflows/stale.yml@main
Loading