Add redirects-needed label #3742
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: Add redirects-needed label | |
on: | |
workflow_run: | |
workflows: ['Redirects Workflow'] | |
types: [completed] | |
env: | |
ARTIFACT_NAME: redirectsArtifact | |
LABEL_TO_ADD: redirects-needed | |
jobs: | |
addRedirectsNeededLabel: | |
name: Add redirects-needed label | |
runs-on: ubuntu-latest | |
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | |
permissions: | |
pull-requests: write # used to add label | |
steps: | |
- name: Checkout repository to get the workflow scripts | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- name: Download artifact | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
env: | |
WORKSPACE: ${{ github.workspace }} | |
with: | |
script: | | |
const { getArtifact } = require('./.github/workflows/scripts/utilities.js'); | |
const fs = require('fs'); | |
const artifactName = process.env.ARTIFACT_NAME; | |
const workspace = process.env.WORKSPACE | |
await getArtifact({github, context, fs, artifactName, workspace}); | |
- name: Unzip artifact | |
run: unzip '${{ env.ARTIFACT_NAME }}.zip' | |
- name: Add redirects-needed label to PR | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { addLabelForDeletedFiles } = require('./.github/workflows/scripts/add_label_for_deleted_files.js'); | |
const fs = require('fs'); | |
const artifactName = process.env.ARTIFACT_NAME; | |
const label = process.env.LABEL_TO_ADD; | |
await addLabelForDeletedFiles({github, context, fs, core, artifactName, label}); |