Skip to content

Commit

Permalink
feat: [#1][#3][#4][#10][#17] Multiple features. (#19)
Browse files Browse the repository at this point in the history
* feat: [#1] Disable or enable wiki tab.

* feat: [#17] Add a description to a GitHub repo.

* feat: [#3][#4][#10] disable merge commits, rebase merging and delete branch on merge.
  • Loading branch information
030 authored Feb 28, 2024
1 parent 05c21ce commit 331c3ca
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# settings-action

Settings Action that will configure the settings of a GitHub repository.

## usage

| Option | Description |
| --------------------- | --------------------------------------------- |
| description | Change the description of a GitHub repository |
| project | The owner/repo |
| settings_discussions | Enable the discussions tab or not |
| settings_merge_rebase | Enable merge request rebase |
| settings_merge_squash | Enable merge request squash |
| settings_projects | Whether the project tab should be enabled |
| settings_wiki | Wiki enabled or not |

```bash
---
name: settings-guard
'on':
schedule:
- cron: '42 6 * * *'
permissions: {}
jobs:
settings-action:
runs-on: ubuntu-22.04
steps:
- uses: 030/settings-action@v0.2.0
env:
GH_TOKEN: ${{ secrets.SETTINGS_GUARD }}
with:
project: 030/settings-guard
description: "Settings Action configures the settings of a GitHub repository."
settings_delete_branch_on_merge: true
settings_discussions: false
settings_merge_rebase: false
settings_merge_squash: false
settings_projects: false
settings_wiki: false
```
31 changes: 31 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
name: settings
description: settings
inputs:
description:
description: |
The description of the GitHub project.
required: true
project:
description: |
The name of the GitHub project including the owner, e.g,
Expand All @@ -11,19 +15,46 @@ inputs:
description: |
Whether the discussions tab should be disabled or enabled.
required: true
settings_merge_rebase:
description: |
Whether the 'merge rebase' option should be disabled or enabled.
required: true
settings_merge_squash:
description: |
Whether the 'merge squash' option should be disabled or enabled.
required: true
settings_projects:
description: |
Whether the projects tab should be disabled or enabled.
required: true
settings_wiki:
description: |
Whether the wiki tab should be disabled or enabled.
required: true
runs:
using: 'composite'
steps:
- name: display the gh cli version
run: gh --version
shell: bash
- name: add a description for project ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --description="${{ inputs.description }}"
shell: bash
- name: delete branch on merge or not for project ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --delete-branch-on-merge=${{ inputs.settings_delete_branch_on_merge }}
shell: bash
- name: disable the 'discussions' tab for ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --enable-discussions=${{ inputs.settings_discussions }}
shell: bash
- name: disable the 'merge rebase' tab for ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --enable-rebase-merge=${{ inputs.settings_merge_rebase }}
shell: bash
- name: disable the 'merge squash' tab for ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --enable-squash-merge=${{ inputs.settings_merge_squash }}
shell: bash
- name: disable the 'projects' tab for ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --enable-projects=${{ inputs.settings_projects }}
shell: bash
- name: disable the 'wiki' tab for ${{ inputs.project }}
run: gh repo edit ${{ inputs.project }} --enable-wiki=${{ inputs.settings_wiki }}
shell: bash

0 comments on commit 331c3ca

Please sign in to comment.