Add redirects-needed label #1
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 https://github.com/actions/checkout/commit/c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- name: Download artifact | |
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410 | |
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 | |
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@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 https://github.com/actions/github-script/commit/d7906e4ad0b1822421a7e6a35d5ca353c962f410 | |
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; | |
addLabelForDeletedFiles({github, context, fs, core, artifactName, label}); |