Skip to content

Commit

Permalink
feat(update-repo-setting): modernize (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown authored Dec 14, 2023
1 parent 1ee2ec6 commit d32f8b0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ branches:
- 'Setup'
- 'CodeQL'
- 'Analyze (TypeScript)'
- 'Update Repository Settings'
enforce_admins: true
required_pull_request_reviews: null
restrictions: null
Expand Down
34 changes: 25 additions & 9 deletions .github/workflows/update-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ name: Update Repository Settings

'on':
push:
branches: [main]
paths:
- '.github/settings.yml'
- '.github/workflows/update-repo-settings.yaml'
schedule:
- cron: '15 16 * * *' # Every day at 16:15 UTC
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

permissions: {}

jobs:
Expand All @@ -24,15 +24,31 @@ jobs:
with:
egress-policy: audit

- name: Get Workflow Access Token
id: get-workflow-access-token
- if: github.event_name == 'push' && github.ref =='refs/heads/main'
name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- id: filter
if: github.event_name == 'push' && github.ref =='refs/heads/main'
name: Filter Changed Files
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
with:
filters: |
changes:
- '.github/settings.yml'
- '.github/workflows/update-repo-settings.yaml'
- id: get-workflow-access-token
if: github.event_name != 'push' || steps.filter.outputs.changes == 'true'
uses: peter-murray/workflow-application-token-action@8e1ba3bf1619726336414f1014e37f17fbadf1db # v2.1.0
name: Get Workflow Access Token
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
permissions: 'administration:write, contents:read, issues:write'

- name: Update Repository Settings
uses: elstudio/actions-settings@v3-beta
env:
- env:
GITHUB_TOKEN: ${{ steps.get-workflow-access-token.outputs.token }}
if: github.event_name != 'push' || steps.filter.outputs.changes == 'true'
name: Update Repository Settings
uses: elstudio/actions-settings@v3-beta

0 comments on commit d32f8b0

Please sign in to comment.