Skip to content

Commit

Permalink
chore: gi automations
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSage committed Dec 1, 2023
1 parent 4e0dbb3 commit c61d23c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/auto-assign-author.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: "Auto Author Assign"
on:
pull_request:
types: [opened]
permissions:
pull-requests: write
jobs:
assign-author:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: toshimaru/[email protected]
with:
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/auto-label-conventional-commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ on:
types: [opened]
pull_request:
types: [opened]

permissions:
issues: write
pull-requests: write

jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Label issue
uses: actions/github-script@v5
- uses: actions/labeler@v4
with:
script: |
const github = require('@actions/github');
const core = require('@actions/core');
const token = core.getInput('github-token', { required: true });
const octokit = github.getOctokit(token);
const title = context.payload.issue ? context.payload.issue.title : context.payload.pull_request.title;
const labelMapping = {
'feat:': 'type: feature request',
Expand All @@ -33,7 +35,7 @@ jobs:
for (const [prefix, label] of Object.entries(labelMapping)) {
if (title.startsWith(prefix)) {
const issue_number = context.payload.issue ? context.issue.number : context.payload.pull_request.number;
github.issues.addLabels({
octokit.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
Expand Down

0 comments on commit c61d23c

Please sign in to comment.