Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add example workflows for GHES #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,43 @@ So the resulting configuration would look like this:

```yaml
jobs:
clean_up:
# <...>
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
# <...>
baseUrl: https://github.mycompany.com/api/v3
clean_up:
# <...>
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
# <...>
baseUrl: https://github.mycompany.com/api/v3
```

You can dynamically set baseUrl using the `${{ github.server_url }}` context instead of hardcoding the GHES URL. This ensures the action works across different GHE instances.

Additionally, if you're using [Automatic Token Authentication](https://docs.github.com/en/enterprise-server/actions/security-for-github-actions/security-guides/automatic-token-authentication) in a GHES environment, you need to set the following permissions: `actions: write` and `contents: read`

```yaml
jobs:
clean_up:
# In GitHub Enterprise, if you encounter 'Resource not accessible by integration' error,
# you need to grant 'actions: write' and 'contents: read' permissions in cleanup step
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
# Auto-generated token during workflow execution
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 14
keep_minimum_runs: 6
# API endpoint for GitHub Enterprise
baseUrl: ${{ github.server_url }}/api/v3
```

This approach eliminates the need to manage a real-human's Personal Access Token (PAT) for authentication, making it more secure and easier to maintain.

##

## License
Expand Down