ronantakizawa/codereview-bench huggingface dataset:
Repository: google/filament
File: libs/filamat/src/eiff/CompressedStringChunk.h (C/C++)

Code before:
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef TNT_COMPRESSEDSTRINGCHUNK_H
#define TNT_COMPRESSEDSTRINGCHUNK_H

#include "Chunk.h"
#include "Flattener.h"

#include <utils/CString.h>

namespace filamat {

class CompressedStringChunk final : public Chunk {
public:
    enum class CompressionLevel { MIN, MAX, DEFAULT };
    CompressedStringChunk(
            ChunkType type, std::string_view string, CompressionLevel compressionLevel)
            : Chunk(type),
              mString(utils::CString(string.data())),
              mCompressionLevel(compressionLevel) {}
    ~CompressedStringChunk() override = default;

private:
    void flatten(Flattener& f) override;
    utils::CString mString;
    CompressionLevel mCompressionLevel;
};

} // namespace filamat


#endif // TNT_COMPRESSEDSTRINGCHUNK_H


Review comment (suggestion):
```suggestion
              mString(utils::CString(string.data(), string.size())),
```

Code after:
*      http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef TNT_COMPRESSEDSTRINGCHUNK_H
#define TNT_COMPRESSEDSTRINGCHUNK_H

#include "Chunk.h"
#include "Flattener.h"

#include <utils/CString.h>

namespace filamat {

class CompressedStringChunk final : public Chunk {
public:
    enum class CompressionLevel { MIN, MAX, DEFAULT };
    CompressedStringChunk(
            ChunkType type, std::string_view string, CompressionLevel compressionLevel)
            : Chunk(type),
              mString(utils::CString(string.data(), string.size())),
              mCompressionLevel(compressionLevel) {}
    ~CompressedStringChunk() override = default;

private:
    void flatten(Flattener& f) override;
    utils::CString mString;
    CompressionLevel mCompressionLevel;
};

} // namespace filamat


#endif // TNT_COMPRESSEDSTRINGCHUNK_H
Repository: google/filament
File: libs/filamat/src/eiff/CompressedStringChunk.cpp (C++)

Code before:
* limitations under the License.
*/

#include "CompressedStringChunk.h"

#include <zstd.h>

namespace filamat {

namespace {
int toZstdCompressionLevel(CompressedStringChunk::CompressionLevel compressionLevel) {
    switch (compressionLevel) {
        case CompressedStringChunk::CompressionLevel::MIN:
            return ZSTD_minCLevel();
        case CompressedStringChunk::CompressionLevel::MAX:
            return ZSTD_maxCLevel();
        case CompressedStringChunk::CompressionLevel::DEFAULT:
            return ZSTD_defaultCLevel();
    }
}
} // namespace

void CompressedStringChunk::flatten(filamat::Flattener& f) {
    const size_t bufferBound = ZSTD_compressBound(mString.size());
    std::vector<std::uint8_t> compressed;
    compressed.reserve(bufferBound);

    const size_t compressedSize = ZSTD_compress(
            compressed.data(), bufferBound,
            mString.data(), mString.size(),
            toZstdCompressionLevel(mCompressionLevel));

    if (ZSTD_isError(compressedSize)) {
        utils::slog.e << "Error compressing the input string." << utils::io::endl;
        return;
    }

    f.writeBlob((const char*) compressed.data(), compressedSize);
}

} // namespace filamat

Review comment (suggestion):
```suggestion
    std::vector<std::uint8_t> compressed(bufferBound);
```

Code after:
* limitations under the License.
*/

#include "CompressedStringChunk.h"

#include <zstd.h>

namespace filamat {

namespace {
int toZstdCompressionLevel(CompressedStringChunk::CompressionLevel compressionLevel) {
    switch (compressionLevel) {
        case CompressedStringChunk::CompressionLevel::MIN:
            return ZSTD_minCLevel();
        case CompressedStringChunk::CompressionLevel::MAX:
            return ZSTD_maxCLevel();
        case CompressedStringChunk::CompressionLevel::DEFAULT:
            return ZSTD_defaultCLevel();
    }
}
} // namespace

void CompressedStringChunk::flatten(filamat::Flattener& f) {
    const size_t bufferBound = ZSTD_compressBound(mString.size());
    std::vector<std::uint8_t> compressed(bufferBound);

    const size_t compressedSize = ZSTD_compress(
            compressed.data(), compressed.size(),
            mString.data(), mString.size(),
            toZstdCompressionLevel(mCompressionLevel));

    if (ZSTD_isError(compressedSize)) {
        utils::slog.e << "Error compressing the input string." << utils::io::endl;
        return;
    }

    f.writeBlob((const char*) compressed.data(), compressedSize);
}

} // namespace filamat
Repository: google/filament
File: libs/filamat/src/eiff/CompressedStringChunk.cpp (C++)

Code before:
#include "CompressedStringChunk.h"

#include <zstd.h>

namespace filamat {

namespace {
int toZstdCompressionLevel(CompressedStringChunk::CompressionLevel compressionLevel) {
    switch (compressionLevel) {
        case CompressedStringChunk::CompressionLevel::MIN:
            return ZSTD_minCLevel();
        case CompressedStringChunk::CompressionLevel::MAX:
            return ZSTD_maxCLevel();
        case CompressedStringChunk::CompressionLevel::DEFAULT:
            return ZSTD_defaultCLevel();
    }
}
} // namespace

void CompressedStringChunk::flatten(filamat::Flattener& f) {
    const size_t bufferBound = ZSTD_compressBound(mString.size());
    std::vector<std::uint8_t> compressed;
    compressed.reserve(bufferBound);

    const size_t compressedSize = ZSTD_compress(
            compressed.data(), bufferBound,
            mString.data(), mString.size(),
            toZstdCompressionLevel(mCompressionLevel));

    if (ZSTD_isError(compressedSize)) {
        utils::slog.e << "Error compressing the input string." << utils::io::endl;
        return;
    }

    f.writeBlob((const char*) compressed.data(), compressedSize);
}

} // namespace filamat

Review comment (suggestion):
```suggestion
            compressed.data(), compressed.size(),
```

Code after:
#include "CompressedStringChunk.h"

#include <zstd.h>

namespace filamat {

namespace {
int toZstdCompressionLevel(CompressedStringChunk::CompressionLevel compressionLevel) {
    switch (compressionLevel) {
        case CompressedStringChunk::CompressionLevel::MIN:
            return ZSTD_minCLevel();
        case CompressedStringChunk::CompressionLevel::MAX:
            return ZSTD_maxCLevel();
        case CompressedStringChunk::CompressionLevel::DEFAULT:
            return ZSTD_defaultCLevel();
    }
}
} // namespace

void CompressedStringChunk::flatten(filamat::Flattener& f) {
    const size_t bufferBound = ZSTD_compressBound(mString.size());
    std::vector<std::uint8_t> compressed(bufferBound);

    const size_t compressedSize = ZSTD_compress(
            compressed.data(), compressed.size(),
            mString.data(), mString.size(),
            toZstdCompressionLevel(mCompressionLevel));

    if (ZSTD_isError(compressedSize)) {
        utils::slog.e << "Error compressing the input string." << utils::io::endl;
        return;
    }

    f.writeBlob((const char*) compressed.data(), compressedSize);
}

} // namespace filamat
Repository: google/filament
File: libs/utils/src/CallStack.cpp (C++)

Code before:
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <utils/CallStack.h>
#include <utils/CString.h>
#include <utils/compiler.h>
#include <utils/ostream.h>

#include <algorithm>
#include <memory>
#include <cstdlib>

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

#if !defined(__ANDROID__) && !defined(WIN32) && !defined(__EMSCRIPTEN__) && defined(__GLIBC__)
#include <execinfo.h>
#define HAS_EXECINFO 1
#else
#define HAS_EXECINFO 0
#endif

// execinfo.h is available as of Android 33
#if defined(__ANDROID__) && (__ANDROID_API__ >= 33)
#include <execinfo.h>
#undef HAS_EXECINFO
#define HAS_EXECINFO 1
#endif

#if !defined(WIN32) && !defined(__EMSCRIPTEN__)
#include <dlfcn.h>
#define HAS_DLADDR 1
#else
#define HAS_DLADDR 0
#endif

#if !defined(NDEBUG) && !defined(WIN32)
#include <cxxabi.h>
#endif

#include <string.h>

Review comment (suggestion):
I'm not super comfortable with adding an conditional for all platform.  How about something like

```
 && (!defined(__linux__) || defined(__GLIBC__))
```

Code after:
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <utils/CallStack.h>
#include <utils/CString.h>
#include <utils/compiler.h>
#include <utils/ostream.h>

#include <algorithm>
#include <memory>
#include <cstdlib>

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

#if !defined(__ANDROID__) && !defined(WIN32) && !defined(__EMSCRIPTEN__) && !(defined(__linux__) && !defined(__GLIBC__))
#include <execinfo.h>
#define HAS_EXECINFO 1
#else
#define HAS_EXECINFO 0
#endif

// execinfo.h is available as of Android 33
#if defined(__ANDROID__) && (__ANDROID_API__ >= 33)
#include <execinfo.h>
#undef HAS_EXECINFO
#define HAS_EXECINFO 1
#endif

#if !defined(WIN32) && !defined(__EMSCRIPTEN__)
#include <dlfcn.h>
#define HAS_DLADDR 1
#else
#define HAS_DLADDR 0
#endif

#if !defined(NDEBUG) && !defined(WIN32)
#include <cxxabi.h>
#endif

#include <string.h>
Repository: google/filament
File: libs/fgviewer/src/WebSocketHandler.h (C/C++)

Code before:
#ifndef FGVIEWER_WEBSOCKET_HANDLER_H
#define FGVIEWER_WEBSOCKET_HANDLER_H

#include <CivetServer.h>

#include <set>
#include <utils/Mutex.h>

namespace filament::fgviewer {

class DebugServer;

class WebSocketHandler : public CivetWebSocketHandler {
public:
    explicit WebSocketHandler(DebugServer* server);

    bool handleConnection(CivetServer* server, const struct mg_connection* conn) override;
    void handleReadyState(CivetServer* server, struct mg_connection* conn) override;
    bool handleData(CivetServer* server, struct mg_connection* conn, int bits, char* data,
            size_t data_len) override;
    void handleClose(CivetServer* server, const struct mg_connection* conn) override;

    void broadcast(const char* data, size_t len);

private:
    DebugServer* mServer;
    utils::Mutex mMutex;
    std::set<struct mg_connection*> mConnections;
};

} // namespace filament::fgviewer

#endif // FGVIEWER_WEBSOCKET_HANDLER_H


Review comment (bug):
nit: Could we make the pointer const? e.g. `DebugServer const* mServer;`

Code after:
#ifndef FGVIEWER_WEBSOCKET_HANDLER_H
#define FGVIEWER_WEBSOCKET_HANDLER_H

#include <CivetServer.h>

#include <unordered_set>
#include <utils/Mutex.h>

namespace filament::fgviewer {

class DebugServer;

class WebSocketHandler : public CivetWebSocketHandler {
public:
    explicit WebSocketHandler(DebugServer* server);

    bool handleConnection(CivetServer* server, const struct mg_connection* conn) override;
    void handleReadyState(CivetServer* server, struct mg_connection* conn) override;
    bool handleData(CivetServer* server, struct mg_connection* conn, int bits, char* data,
            size_t data_len) override;
    void handleClose(CivetServer* server, const struct mg_connection* conn) override;

    void broadcast(const char* data, size_t len);

private:
    DebugServer const* mServer;
    utils::Mutex mMutex;
    std::unordered_set<struct mg_connection*> mConnections;
};

} // namespace filament::fgviewer

#endif // FGVIEWER_WEBSOCKET_HANDLER_H
Repository: google/go-github
File: github/issues_test.go (Go)

Code before:
	_, _, err := client.Issues.Edit(context.Background(), "%", "r", 1, nil)
	testURLParseError(t, err)
}

func TestIssuesService_Lock(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		w.WriteHeader(http.StatusNoContent)
	})

	if _, err := client.Issues.Lock(context.Background(), "o", "r", 1, nil); err != nil {
		t.Errorf("Issues.Lock returned error: %v", err)
	}
}

func TestIssuesService_LockWithReason(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		w.WriteHeader(http.StatusNoContent)
	})

	opt := &LockIssueOptions{LockReason: "off-topic"}

	if _, err := client.Issues.Lock(context.Background(), "o", "r", 1, opt); err != nil {
		t.Errorf("Issues.Lock returned error: %v", err)
	}
}

func TestIssuesService_Unlock(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "DELETE")

		w.WriteHeader(http.StatusNoContent)
	})

	if _, err := client.Issues.Unlock(context.Background(), "o", "r", 1); err != nil {
		t.Errorf("Issues.Unlock returned error: %v", err)
	}
}


Review comment (suggestion):
Can you please add a `testHeader` here?
That makes it easier to maintain so that when the header is later removed, it is clear that this needs cleaning up here as well.

Code after:

	mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")

		w.WriteHeader(http.StatusNoContent)
	})

	if _, err := client.Issues.Lock(context.Background(), "o", "r", 1, nil); err != nil {
		t.Errorf("Issues.Lock returned error: %v", err)
	}
}

func TestIssuesService_LockWithReason(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "PUT")
		testHeader(t, r, "Accept", mediaTypeLockReasonPreview)
		w.WriteHeader(http.StatusNoContent)
	})

	opt := &LockIssueOptions{LockReason: "off-topic"}

	if _, err := client.Issues.Lock(context.Background(), "o", "r", 1, opt); err != nil {
		t.Errorf("Issues.Lock returned error: %v", err)
	}
}

func TestIssuesService_Unlock(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/issues/1/lock", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "DELETE")

		w.WriteHeader(http.StatusNoContent)
	})

	if _, err := client.Issues.Unlock(context.Background(), "o", "r", 1); err != nil {
		t.Errorf("Issues.Unlock returned error: %v", err)
	}
}

func TestIsPullRequest(t *testing.T) {
	i := new(Issue)
	if i.IsPullRequest() == true {
		t.Errorf("expected i.IsPullRequest (%v) to return false, got true", i)
	}
	i.PullRequestLinks = &PullRequestLinks{URL: String("http://example.com")}
	if i.IsPullRequest() == false {
Repository: google/go-github
File: github/repos_prereceive_hooks_test.go (Go)

Code before:
// Copyright 2013 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"reflect"
	"testing"
)

func TestRepositoriesService_ListPreReceiveHooks(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/pre-receive-hooks", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testFormValues(t, r, values{"page": "2"})
		fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
	})

	opt := &ListOptions{Page: 2}

	hooks, _, err := client.Repositories.ListPreReceiveHooks(context.Background(), "o", "r", opt)
	if err != nil {
		t.Errorf("Repositories.ListHooks returned error: %v", err)
	}

	want := []*PreReceiveHook{{ID: Int64(1)}, {ID: Int64(2)}}
	if !reflect.DeepEqual(hooks, want) {
		t.Errorf("Repositories.ListPreReceiveHooks returned %+v, want %+v", hooks, want)
	}
}

func TestRepositoriesService_ListPreReceiveHooks_invalidOwner(t *testing.T) {
	client, _, _, teardown := setup()
	defer teardown()

	_, _, err := client.Repositories.ListPreReceiveHooks(context.Background(), "%", "%", nil)
	testURLParseError(t, err)
}


Review comment (suggestion):
Here and below, please add `testHeader` to check for the custom media type specified in the header.
That helps us to keep this repo cleaner by explicitly calling out when custom media headers are being used.

Code after:
// Copyright 2018 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"context"
	"encoding/json"
	"fmt"
	"net/http"
	"reflect"
	"testing"
)

func TestRepositoriesService_ListPreReceiveHooks(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/pre-receive-hooks", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testHeader(t, r, "Accept", mediaTypePreReceiveHooksPreview)
		testFormValues(t, r, values{"page": "2"})
		fmt.Fprint(w, `[{"id":1}, {"id":2}]`)
	})

	opt := &ListOptions{Page: 2}

	hooks, _, err := client.Repositories.ListPreReceiveHooks(context.Background(), "o", "r", opt)
	if err != nil {
		t.Errorf("Repositories.ListHooks returned error: %v", err)
	}

	want := []*PreReceiveHook{{ID: Int64(1)}, {ID: Int64(2)}}
	if !reflect.DeepEqual(hooks, want) {
		t.Errorf("Repositories.ListPreReceiveHooks returned %+v, want %+v", hooks, want)
	}
}

func TestRepositoriesService_ListPreReceiveHooks_invalidOwner(t *testing.T) {
	client, _, _, teardown := setup()
	defer teardown()

	_, _, err := client.Repositories.ListPreReceiveHooks(context.Background(), "%", "%", nil)
	testURLParseError(t, err)
}
Repository: google/go-github
File: github/checks_test.go (Go)

Code before:
		Status:     String("completed"),
		HeadSHA:    String("deadbeef"),
		HeadBranch: String("master"),
		Conclusion: String("neutral"),
		BeforeSHA:  String("deadbeefb"),
		AfterSHA:   String("deadbeefa"),
	}
	if !reflect.DeepEqual(checkSuite, want) {
		t.Errorf("Checks.CreateCheckSuite return %+v, want %+v", checkSuite, want)
	}
}

func TestChecksService_ReRequestCheckSuite(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/check-suites/1/rerequest", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "POST")
		testHeader(t, r, "Accept", mediaTypeCheckRunsPreview)
		w.WriteHeader(http.StatusCreated)
	})
	resp, err := client.Checks.ReRequestCheckSuite(context.Background(), "o", "r", 1)
	if err != nil {
		t.Errorf("Checks.ReRequestCheckSuite return error: %v", err)
	}
	if resp.StatusCode != 201 {
		t.Errorf("Checks.ReRequestCheckSuite return %+v, want 201", resp.StatusCode)
	}
}


Review comment (suggestion):
I know that you didn't write this code originally, but if you don't mind making it a bit more idiomatic Go while we are here, could you please change this to:

```go
if got, want := resp.StatusCode, http.StatusCreated; got != want {
	t.Errorf("Checks.ReRequestCheckSuite = %v, want %v", got, want)
}
```

Code after:
		Status:     String("completed"),
		HeadSHA:    String("deadbeef"),
		HeadBranch: String("master"),
		Conclusion: String("neutral"),
		BeforeSHA:  String("deadbeefb"),
		AfterSHA:   String("deadbeefa"),
	}
	if !reflect.DeepEqual(checkSuite, want) {
		t.Errorf("Checks.CreateCheckSuite return %+v, want %+v", checkSuite, want)
	}
}

func TestChecksService_ReRequestCheckSuite(t *testing.T) {
	client, mux, _, teardown := setup()
	defer teardown()

	mux.HandleFunc("/repos/o/r/check-suites/1/rerequest", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "POST")
		testHeader(t, r, "Accept", mediaTypeCheckRunsPreview)
		w.WriteHeader(http.StatusCreated)
	})
	resp, err := client.Checks.ReRequestCheckSuite(context.Background(), "o", "r", 1)
	if err != nil {
		t.Errorf("Checks.ReRequestCheckSuite return error: %v", err)
	}
	if got, want := resp.StatusCode, http.StatusCreated; got != want {
		t.Errorf("Checks.ReRequestCheckSuite = %v, want %v", got, want)
	}
}
Repository: google/go-github
File: github/repos_actions_access.go (Go)

Code before:
	if err != nil {
		return nil, nil, err
	}

	raal := new(RepositoryActionsAccessLevel)
	resp, err := s.client.Do(ctx, req, raal)
	if err != nil {
		return nil, resp, err
	}

	return raal, resp, nil
}

// EditActionsAccessLevel sets the level of access that workflows outside of the repository have
// to actions and reusable workflows in the repository.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository
func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo)
	req, err := s.client.NewRequest("PUT", u, repositoryActionsAccessLevel)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.Do(ctx, req, nil)
	return resp, err
}


Review comment (suggestion):
```suggestion
	return s.client.Do(ctx, req, nil)
```

Code after:
	if err != nil {
		return nil, nil, err
	}

	raal := new(RepositoryActionsAccessLevel)
	resp, err := s.client.Do(ctx, req, raal)
	if err != nil {
		return nil, resp, err
	}

	return raal, resp, nil
}

// EditActionsAccessLevel sets the level of access that workflows outside of the repository have
// to actions and reusable workflows in the repository.
//
// GitHub API docs: https://docs.github.com/en/rest/actions/permissions#set-the-level-of-access-for-workflows-outside-of-the-repository
func (s *RepositoriesService) EditActionsAccessLevel(ctx context.Context, owner, repo string, repositoryActionsAccessLevel RepositoryActionsAccessLevel) (*Response, error) {
	u := fmt.Sprintf("repos/%v/%v/actions/permissions/access", owner, repo)
	req, err := s.client.NewRequest("PUT", u, repositoryActionsAccessLevel)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}