workflow: delete old review workflows

Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
Johan Haals
2022-07-05 10:20:02 +02:00
parent f863b1a730
commit 2bf266e15a
3 changed files with 0 additions and 299 deletions
@@ -1,31 +0,0 @@
# on a review from someone in the reviewers group, remove the awaiting-review label and add the awaiting-author label
name: Automate review labels - scheduled
on:
schedule:
- cron: '* * * * *'
jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Get Token
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v1
with:
application_id: ${{ secrets.BACKSTAGE_GOALIE_APPLICATION_ID }}
application_private_key: ${{ secrets.BACKSTAGE_GOALIE_PRIVATE_KEY }}
organization: backstage
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- run: npm install codeowners
- uses: actions/github-script@v6
id: fix-labels
with:
github-token: ${{ steps.get_workflow_token.outputs.token }}
script: |
const script = require('./scripts/goalie-labels.js')
await script({github, context, core})
@@ -1,84 +0,0 @@
# When the target of the PR changes, open, re-open or sync, then re-add the label.
name: Automate review labels
on:
pull_request_target:
types:
- opened
- closed
- synchronize
permissions:
issues: write
pull-requests: write
jobs:
label:
runs-on: ubuntu-latest
steps:
# THESE SCRIPTS SHOULD BE INLINED AND NOT IN REPO
# DUE TO THE TOKEN PERMISSIONS THAT ARE GIVEN
# TO THE WORKFLOW. THIS SCRIPT WILL AND SHOULD
# RUN FROM THE BASE REPO ALL TIMES.
- uses: actions/github-script@v6
id: fix-labels
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
if (['opened', 'synchronize'].includes('${{ github.event.action }}')) {
// if it's the author, always add awaiting-review label
const isAuthor = context.payload.pull_request.user.login === context.actor
if (isAuthor) {
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['awaiting-review']
});
}
}
if ('${{ github.event.action}}' === 'closed') {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'awaiting-review'
}).catch((e) => {
console.log(e)
});
}
- name: Add PRs to review board
uses: actions/github-script@v6
if: github.event.action == 'opened' || github.event.action == 'reopened'
env:
PROJECT_ID: PN_kwDOBFKqdc02LQ
with:
github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
script: |
const prLookup = await github.graphql(`
query($owner: String!, $repo: String!, $number: Int!){
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
id
}
}
}
`, context.issue);
await github.graphql(`
mutation($projectId: ID!, $contentId: ID!) {
addProjectNextItem(input: {
projectId: $projectId,
contentId: $contentId,
}) {
projectNextItem {
id
}
}
}
`, {
projectId: process.env.PROJECT_ID,
contentId: prLookup.repository.pullRequest.id
})