Skip to content

Add deleted-assets label #3692

Add deleted-assets label

Add deleted-assets label #3692

name: Add deleted-assets label
on:
workflow_run:
workflows: ['Deleted Assets Workflow']
types: [completed]
env:
ARTIFACT_NAME: deletedAssetsArtifact
LABEL_TO_ADD: deleted-assets
jobs:
addRedirectsNeededLabel:
name: Add deleted-assets 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});