diff --git a/.github/workflows/set-default-labels.yml b/.github/workflows/set-default-labels.yml deleted file mode 100644 index 841b845..0000000 --- a/.github/workflows/set-default-labels.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: set-default-labels - -on: - workflow_call: - inputs: - target-repo: - description: The repo to run this action on. This is to prevent actions from running on forks unless intended. - required: true - type: string - should-delete-labels: - description: "Delete labels that are not in the list" - default: false - required: false - type: boolean - -jobs: - set-default-labels: - if: github.repository == inputs.target-repo - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v5 - with: - persist-credentials: false - - uses: lannonbr/issue-label-manager-action@e8dbcd8198e86a1e98d5372e55db976fed9ba6f7 # v4.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - delete: ${{ inputs.should-delete-labels }} diff --git a/README.md b/README.md index 131ec55..7321b8b 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,3 @@ Reusable GitHub Actions workflows for use in MDN repositories. - [lock-closed](.github/workflows/lock-closed.yml) ([docs](docs/lock-closed.md)) - lock closed issues and pull requests - [new-issues](.github/workflows/new-issues.yml) ([docs](docs/new-issues.md)) - label new issues - [pr-rebase-needed](.github/workflows/pr-rebase-needed.yml) ([docs](docs/pr-rebase-needed.md)) - label pull requests that have merge conflicts -- [set-default-labels](.github/workflows/set-default-labels.yml) ([docs](docs/set-default-labels.md)) - set default labels on new issues and pull requests diff --git a/docs/set-default-labels.md b/docs/set-default-labels.md deleted file mode 100644 index f94da22..0000000 --- a/docs/set-default-labels.md +++ /dev/null @@ -1,76 +0,0 @@ -# set-default-labels - -The `set-default-labels` reusable action is located at [`.github/workflows/set-default-labels.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/set-default-labels.yml). - -This reusable action depends on the following actions: - -- [checkout](https://github.com/marketplace/actions/checkout) -- [lannonbr/issue-label-manager-action](https://github.com/marketplace/actions/issue-label-manager-action) - -## Inputs - -The action has the following inputs: - -### Required inputs - -#### target-repo - -Specify the target repository this action should run on. This is used to prevent actions from running on repositories other than the target repository. For example, specifying a `target-repo` of `mdn/workflows` will prevent the action from running on forks of `mdn/workflows`. - -- This `input` is required. (`type:string`) - -### Optional inputs - -#### should-delete-labels - -This is an optional `boolean` input that is `false` by default. If set to `true`, the action will delete any existing labels that are not listed in the JSON file mentioned previously. - -## Usage - -In the repository that will call this action, you will need to create the following file: `.github/labels.json`. The content of the file can be something like the following: - -```json -[ - { - "name": "bug", - "color": "#d73a4a", - "description": "something isn’t working" - }, - { - "name": "chore", - "color": "#fef2c0", - "description": "keeping the lights on" - } -] -``` - -You can find more details about the above on the [issue-label-manager-action documentation](https://github.com/marketplace/actions/issue-label-manager-action#issue-label-manager-action). The next item you need to create in the repository that will call this action, is a workflow file. You can name the file `.github/workflows/set-default-labels.yml` and add the following content: - -### With defaults - -```yml -name: set-default-labels -on: [workflow_dispatch] - -jobs: - set-default-labels: - uses: mdn/workflows/.github/workflows/set-default-labels.yml@main - with: - target-repo: "mdn/workflows" -``` - -### Overriding some defaults - -```yml -name: set-default-labels -on: [workflow_dispatch] - -jobs: - set-default-labels: - uses: mdn/workflows/.github/workflows/set-default-labels.yml@main - with: - target-repo: "mdn/workflows" - should-delete-labels: true -``` - -Because of the nature of this action, it must be run manually. You can learn more about [manually running actions on GitHub](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow).