Plan Management 📝 #7731
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Plan Management 📝 | |
on: | |
pull_request: | |
types: [opened, reopened] | |
issues: | |
types: [opened, reopened] | |
schedule: | |
- cron: "42 */2 * * *" | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
jobs: | |
triage: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'issues' || github.event_name == 'pull_request' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
const { owner, repo } = context.repo | |
const labelsCount = context.payload.issue?.labels?.length || context.payload.pull_request?.labels?.length || 0 | |
console.log(`Issue/PR #${context.payload.issue?.number || context.payload.pull_request?.number} has ${labelsCount} labels.`) | |
if (labelsCount == 0) { | |
github.rest.issues.addLabels({ | |
issue_number: context.payload.issue?.number || context.payload.pull_request?.number, | |
owner, | |
repo, | |
labels: ["state/triage 🚦"] | |
}) | |
} | |
sponsors: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'issues' || github.event_name == 'pull_request' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/github-script@v7 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_SPONSOR_CHECKING }} | |
with: | |
script: | | |
const { owner, repo } = context.repo | |
const { repositoryOwner } = await github.graphql( | |
`query($owner: String!, $sponsor: String!) { | |
repositoryOwner(login: $owner) { | |
... on User { | |
isSponsoredBy(accountLogin: $sponsor) | |
} | |
} | |
}`, | |
{ | |
owner: owner, | |
sponsor: context.payload.issue?.user?.login || context.payload.pull_request?.user?.login, | |
headers: { | |
authorization: `token ${process.env.GITHUB_TOKEN}` | |
} | |
} | |
) | |
console.log("request response", JSON.stringify(repositoryOwner, null, 2)) | |
if (repositoryOwner.isSponsoredBy) { | |
github.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: context.payload.issue?.number || context.payload.pull_request?.number, | |
labels: ["sponsor 💖"] | |
}) | |
} | |
stale: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'schedule' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/stale@v9 | |
with: | |
exempt-all-milestones: true | |
exempt-assignees: "42Atomys" | |
enable-statistics: true | |
operations-per-run: 100 | |
days-before-issue-stale: 28 | |
days-before-issue-close: 14 | |
days-before-pr-stale: -1 | |
days-before-pr-close: -1 | |
stale-issue-label: "stale/stale 🦴" | |
stale-issue-message: "This issue is stale because it has been open for 28 days with no activity." | |
close-issue-label: "stale/dead 💀" | |
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." | |
stale-pr-label: "stale/stale 🦴" | |
stale-pr-message: "This pull request is stale because it has been open for 28 days with no activity." | |
close-pr-label: "stale/dead 💀" | |
close-pr-message: "This pull request was closed because it has been inactive for 14 days since being marked as stale." | |
exempt-issue-labels: "state/confirmed 💜,stale/lock 🔒" | |
exempt-pr-labels: "state/confirmed 💜,stale/lock 🔒" | |
labels-to-add-when-unstale: "stale/unstale 🍖" | |
labels-to-remove-when-unstale: "stale/stale 🦴,stale/dead 💀" |