-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kyle Harding <[email protected]>
- Loading branch information
Showing
2 changed files
with
131 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,7 +111,7 @@ jobs: | |
defaults: | ||
run: | ||
shell: bash | ||
working-directory: . | ||
working-directory: ${{ matrix.repo.full_name }}/.github | ||
|
||
strategy: | ||
fail-fast: false | ||
|
@@ -167,16 +167,21 @@ jobs: | |
token: ${{ steps.github-app-token.outputs.token }} | ||
|
||
# Create a symlink to the preferred settings file. | ||
- name: Link to settings file | ||
- name: Select settings file | ||
working-directory: ${{ matrix.repo.full_name }} | ||
env: | ||
FILES: >- | ||
${{ matrix.repo.full_name }}/.github/settings.yml | ||
${{ github.event.repository.full_name }}/repo-settings.yml | ||
${{ github.event.repository.full_name }}/.github/settings.yml | ||
${{ github.workspace}}/${{ github.event.repository.full_name }}/repo-settings.yml | ||
${{ github.workspace}}/${{ github.event.repository.full_name }}/.github/settings.yml | ||
run: | | ||
mkdir -p .github | ||
if [ -f settings.yml ]; then | ||
exit 0 | ||
fi | ||
for file in $FILES; do | ||
if [ -f "$file" ]; then | ||
echo "Found settings file: $file" | ||
ln -sv $file settings.yml | ||
break | ||
fi | ||
|
@@ -210,22 +215,41 @@ jobs: | |
- name: Merge default branch required checks | ||
if: steps.get-branch-protection.outcome == 'success' | ||
run: | | ||
yq eval-all '.branch_protections[0].protection.required_status_checks.checks += load("response.yml") | | ||
.branch_protections[0].protection.required_status_checks.checks |= unique' settings.yml > settings.yml.tmp | ||
yq eval-all '.branches[0].protection.required_status_checks.checks += load("response.yml") | | ||
.branches[0].protection.required_status_checks.checks |= unique' settings.yml > settings.yml.tmp | ||
mv settings.yml.tmp settings.yml | ||
yq . settings.yml | ||
# https://github.com/andrewthetechie/gha-repo-manager | ||
- name: Run repo manager | ||
uses: andrewthetechie/[email protected] | ||
id: repo-manager | ||
continue-on-error: true | ||
with: | ||
action: ${{ needs.prepare.outputs.action }} | ||
token: ${{ steps.github-app-token.outputs.token }} | ||
settings_file: settings.yml | ||
|
||
- name: Record diff | ||
if: steps.repo-manager.outputs.diff != '' | ||
# https://github.com/elstudio/actions-settings | ||
# https://github.com/repository-settings/app | ||
# https://github.com/apps/settings | ||
- name: Install and run probot/settings | ||
env: | ||
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables | ||
GITHUB_TOKEN: ${{ steps.github-app-token.outputs.token }} | ||
ACTIONS_STEP_DEBUG: true | ||
LOG_LEVEL: true | ||
# # The name of the event that triggered the workflow. For example, workflow_dispatch. | ||
# GITHUB_EVENT_NAME: | ||
# # The path to the file on the runner that contains the full event webhook payload. For example, /github/workflow/event.json. | ||
# GITHUB_EVENT_PATH: | ||
run: | | ||
echo "${{ steps.repo-manager.outputs.diff }}" | tee -a $GITHUB_STEP_SUMMARY | ||
npm install -g github:repository-settings/[email protected] | ||
probot receive -e $GITHUB_EVENT_NAME -p $GITHUB_EVENT_PATH -t $GITHUB_TOKEN /app/node_modules/repository-settings/index.js | ||
# Usage: probot-receive [options] [path/to/app.js...] | ||
|
||
# Options: | ||
# -e, --event <event-name> Event name | ||
# -p, --payload-path <payload-path> Path to the event payload | ||
# -t, --token <access-token> Access token | ||
# -a, --app <id> ID of the GitHub App | ||
# -P, --private-key <file> Path to private key file (.pem) for the GitHub App | ||
# -L, --log-level <level> One of: "trace" | "debug" | "info" | "warn" | "error" | "fatal" | ||
# --log-format <format> One of: "pretty", "json" (default: "pretty") | ||
# --log-level-in-string Set to log levels (trace, debug, info, ...) as words instead of numbers (10, 20, 30, ...) (default: false) | ||
# --log-message-key Set to the string key for the 'message' in the log JSON object | ||
# --sentry-dsn <dsn> Set to your Sentry DSN, e.g. "https://[email protected]/12345" | ||
# --base-url <url> GitHub API base URL. If you use GitHub Enterprise Server, and your hostname is "https://github.acme-inc.com", then the root URL is "https://github.acme-inc.com/api/v3" (default: | ||
# "https://api.github.com") | ||
# -h, --help display help for command |