diff --git a/.github/workflows/new_issue.yaml b/.github/workflows/new_issue.yaml new file mode 100644 index 00000000..19e4c843 --- /dev/null +++ b/.github/workflows/new_issue.yaml @@ -0,0 +1,31 @@ +name: New issue +on: + issues: + types: + - opened + - reopened +jobs: + new_issue: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + # https://docs.github.com/en/actions/managing-issues-and-pull-requests/adding-labels-to-issues + - uses: actions/github-script@v6 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ["untriaged"] + }) + # https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects#adding-an-item-to-a-project + - run: | + gh api graphql -f query="mutation { addProjectV2ItemById(input: {projectId: \"$PROJECT_ID\" contentId: \"$CONTENT_ID\"}) { item { id } } }" + env: + GITHUB_TOKEN: ${{ secrets.GH_PROJECTS_RW_TOKEN }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} + CONTENT_ID: ${{ github.event.issue.node_id }} + PROJECT_ID: PVT_kwDOA6IKMs4ALj2o # Aspect OSS Bazel Rules diff --git a/.github/workflows/new_pr.yaml b/.github/workflows/new_pr.yaml new file mode 100644 index 00000000..b3520cc4 --- /dev/null +++ b/.github/workflows/new_pr.yaml @@ -0,0 +1,21 @@ +name: New PR +on: + pull_request: + types: + - opened + - reopened +jobs: + new_pr: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + # https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects#adding-an-item-to-a-project + - run: | + gh api graphql -f query="mutation { addProjectV2ItemById(input: {projectId: \"$PROJECT_ID\" contentId: \"$CONTENT_ID\"}) { item { id } } }" + env: + GITHUB_TOKEN: ${{ secrets.GH_PROJECTS_RW_TOKEN }} + OWNER: ${{ github.repository_owner }} + REPO: ${{ github.event.repository.name }} + CONTENT_ID: ${{ github.event.pull_request.node_id }} + PROJECT_ID: PVT_kwDOA6IKMs4ALj2o # Aspect OSS Bazel Rules