potd - Minimum Add to Make Parentheses Valid #4
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: Auto Label Issues and PRs | |
permissions: | |
issues: write | |
pull-requests: write | |
on: | |
pull_request: | |
types: | |
- opened | |
issues: | |
types: | |
- opened | |
jobs: | |
auto-label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Add default labels to PRs | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const labels = ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest']; | |
if (labels.length > 0) { | |
github.rest.issues.addLabels({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: labels | |
}); | |
} else { | |
console.log("No labels to add for PR"); | |
} | |
- name: Add default labels to Issues | |
if: github.event_name == 'issues' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const labels = ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest']; | |
if (labels.length > 0) { | |
github.rest.issues.addLabels({ | |
issue_number: context.payload.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: labels | |
}); | |
} else { | |
console.log("No labels to add for Issues"); | |
} | |
label-prs: #labling pr | |
runs-on: ubuntu-latest | |
outputs: | |
label: ${{ steps.set-label.outputs.label }} | |
steps: | |
- name: Determine PR Label | |
id: set-label | |
run: | | |
if [[ "${{ github.event.pull_request.title }}" =~ bug ]]; then | |
echo "::set-output name=label::bug" | |
elif [[ "${{ github.event.pull_request.title }}" =~ documentation ]]; then | |
echo "::set-output name=label::documentation" | |
elif [[ "${{ github.event.pull_request.title }}" =~ enhancement ]]; then | |
echo "::set-output name=label::enhancement" | |
elif [[ "${{ github.event.pull_request.title }}" =~ hacktoberfest ]]; then | |
echo "::set-output name=label::hacktoberfest" | |
fi | |
label-issues: | |
runs-on: ubuntu-latest | |
outputs: | |
label: ${{ steps.set-label.outputs.label }} | |
steps: | |
- name: Determine Issue Label | |
id: set-label | |
run: | | |
if [[ "${{ github.event.issue.title }}" =~ bug ]]; then | |
echo "::set-output name=label::bug" | |
elif [[ "${{ github.event.issue.title }}" =~ "Something isn't working" ]]; then | |
echo "::set-output name=label::'Something isn't working'" | |
elif [[ "${{ github.event.issue.title }}" =~ documentation ]]; then | |
echo "::set-output name=label::documentation" | |
elif [[ "${{ github.event.issue.title }}" =~ "Improvements or additions to documentation" ]]; then | |
echo "::set-output name=label::'Improvements or additions to documentation'" | |
elif [[ "${{ github.event.issue.title }}" =~ duplicate ]]; then | |
echo "::set-output name=label::duplicate" | |
elif [[ "${{ github.event.issue.title }}" =~ enhancement ]]; then | |
echo "::set-output name=label::enhancement" | |
elif [[ "${{ github.event.issue.title }}" =~ "good first issue" ]]; then | |
echo "::set-output name=label::'good first issue'" | |
elif [[ "${{ github.event.issue.title }}" =~ hacktoberfest ]]; then | |
echo "::set-output name=label::hacktoberfest" | |
elif [[ "${{ github.event.issue.title }}" =~ question ]]; then | |
echo "::set-output name=label::question" | |
fi | |
# name: Auto Label Issues and PRs | |
# permissions: | |
# issues: write | |
# pull-requests: write | |
# on: | |
# pull_request: | |
# types: | |
# - opened | |
# issues: | |
# types: | |
# - opened | |
# jobs: | |
# auto-label: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Add default labels to PRs | |
# if: github.event_name == 'pull_request' | |
# uses: actions/github-script@v6 | |
# with: | |
# script: | | |
# github.rest.issues.addLabels({ | |
# issue_number: context.payload.pull_request.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# labels: ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest'] | |
# }) | |
# - name: Add default labels to Issues | |
# if: github.event_name == 'issues' | |
# uses: actions/github-script@v6 | |
# with: | |
# script: | | |
# github.rest.issues.addLabels({ | |
# issue_number: context.payload.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# labels: ['Hactoberfest_2024', 'Hactoberfest-accepted', 'Hactoberfest'] | |
# }) | |
# label-prs: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# label: ${{ steps.set-label.outputs.label }} | |
# steps: | |
# - name: Determine PR Label | |
# id: set-label | |
# run: | | |
# if [[ "${{ github.event.pull_request.title }}" =~ bug ]]; then | |
# echo "::set-output name=label::bug" | |
# elif [[ "${{ github.event.pull_request.title }}" =~ documentation ]]; then | |
# echo "::set-output name=label::documentation" | |
# elif [[ "${{ github.event.pull_request.title }}" =~ enhancement ]]; then | |
# echo "::set-output name=label::enhancement" | |
# elif [[ "${{ github.event.pull_request.title }}" =~ hacktoberfest ]]; then | |
# echo "::set-output name=label::hacktoberfest" | |
# fi | |
# label-issues: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# label: ${{ steps.set-label.outputs.label }} | |
# steps: | |
# - name: Determine Issue Label | |
# id: set-label | |
# run: | | |
# if [[ "${{ github.event.issue.title }}" =~ bug ]]; then | |
# echo "::set-output name=label::bug" | |
# elif [[ "${{ github.event.issue.title }}" =~ "Something isn't working" ]]; then | |
# echo "::set-output name=label::Something isn't working" | |
# elif [[ "${{ github.event.issue.title }}" =~ documentation ]]; then | |
# echo "::set-output name=label::documentation" | |
# elif [[ "${{ github.event.issue.title }}" =~ "Improvements or additions to documentation" ]]; then | |
# echo "::set-output name=label::Improvements or additions to documentation" | |
# elif [[ "${{ github.event.issue.title }}" =~ duplicate ]]; then | |
# echo "::set-output name=label::duplicate" | |
# elif [[ "${{ github.event.issue.title }}" =~ enhancement ]]; then | |
# echo "::set-output name=label::enhancement" | |
# elif [[ "${{ github.event.issue.title }}" =~ "good first issue" ]]; then | |
# echo "::set-output name=label::good first issue" | |
# elif [[ "${{ github.event.issue.title }}" =~ hacktoberfest ]]; then | |
# echo "::set-output name=label::hacktoberfest" | |
# elif [[ "${{ github.event.issue.title }}" =~ question ]]; then | |
# echo "::set-output name=label::question" | |
# fi | |
# # name: Auto Label for PRs and Issues | |
# # permissions: | |
# # issues: write | |
# # pull-requests: write | |
# # on: | |
# # pull_request: | |
# # types: | |
# # - opened | |
# # issues: | |
# # types: | |
# # - opened | |
# # jobs: | |
# # auto-label: | |
# # runs-on: ubuntu-latest | |
# # steps: | |
# # - name: Checkout repository | |
# # uses: actions/checkout@v3 | |
# # - name: Add "contributor" label to PRs | |
# # if: github.event_name == 'pull_request' | |
# # uses: actions-ecosystem/action-add-labels@v1 | |
# # with: | |
# # github_token: ${{ secrets.GITHUB_TOKEN }} | |
# # labels: "contributor" | |
# # - name: Add "issue" label to Issues | |
# # if: github.event_name == 'issues' | |
# # uses: actions-ecosystem/action-add-labels@v1 | |
# # with: | |
# # github_token: ${{ secrets.GITHUB_TOKEN }} | |
# # labels: "issue" |