-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Enable everything #1
Conversation
synced-files/.github/labels.yml
Outdated
@@ -0,0 +1,107 @@ | |||
- name: "bug :bug:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a file I used for testing.
.github/workflows/sync.yml
Outdated
//return trackRepos.flatMap(({ full_name }) => full_name === 'exercism/research_experiment_1' ? [] : [full_name]) | ||
|
||
// TODO: Before merge, remove this and uncomment the line above | ||
return ['exercism/julia'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//return trackRepos.flatMap(({ full_name }) => full_name === 'exercism/research_experiment_1' ? [] : [full_name]) | |
// TODO: Before merge, remove this and uncomment the line above | |
return ['exercism/julia'] | |
return trackRepos.flatMap(({ full_name }) => full_name === 'exercism/research_experiment_1' ? [] : [full_name]) |
^ To 'arm' the repo/workflow before merging
How it works: On each push to the After pushing, you have 5 minutes to abort the workflow, in case there are any errors in the files that should be synced. |
.github/workflows/sync.yml
Outdated
}) | ||
|
||
// research_experiment_1 is not a real track, don't treat it as one | ||
//return trackRepos.flatMap(({ full_name }) => full_name === 'exercism/research_experiment_1' ? [] : [full_name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just removed the label from this track (cc @ErikSchierboom for your scripts too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me, but it is hard to review these CI actions :)
with: | ||
github-token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }} | ||
script: | | ||
const botRepos = await github.paginate(github.repos.listForAuthenticatedUser, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird that you can filter on forks. 🤷
.github/workflows/sync.yml
Outdated
// Replacing the bot username with exercism is slightly hacky, but necessary | ||
// for the comparison below. Unfortunately, GitHub's API response does not seem | ||
// to contain any reference to the upstream repo of the fork. | ||
const botForks = botRepos.flatMap(({ full_name, fork }) => fork ? [full_name.replace(process.env.BOT_USERNAME, 'exercism')] : []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The graphql API does allow for referencing the upstream repo, which they refer to as the "parent". E.g., the following graphql will output all the forked repos with their forked name and upstream name:
{
user(login: "ErikSchierboom") {
repositories(first: 100, isFork: true) {
nodes {
nameWithOwner
parent {
nameWithOwner
}
}
}
}
}
Which outputs:
{
"data": {
"user": {
"repositories": {
"nodes": [
{
"nameWithOwner": "ErikSchierboom/fsharp",
"parent": {
"nameWithOwner": "exercism/fsharp"
}
},
{
"nameWithOwner": "ErikSchierboom/problem-specifications",
"parent": {
"nameWithOwner": "exercism/problem-specifications"
}
},
...
]
}
}
}
}
You can try this yourself at https://docs.github.com/en/graphql/overview/explorer
According to the docs, actions/github-script
allows you to run graphql queries: https://github.com/actions/toolkit/tree/master/packages/github
The main disadvantage is that you'd have to do manual pagination, so it might be not that convenient after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be useful, I'll take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave this open as a future TODO for now, I'm not sure if the added complexity of manual pagination is worth it, and I don't know graphql at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
// Forking repos happens asynchronously on GitHub, therefore | ||
// we need to sleep a bit to ensure it has been created | ||
await new Promise(x => setTimeout(x, 60000)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use a different mechanism (e.g. polling) to be certain that the fork was actually created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's worth it. Tracks aren't created that often, this will rarely ever run
There are three GitHub Actions workflows that are present in many Exercism repositories, but whose contents are identical: 1. Track repos: the workflow to run `configlet lint` 2. Tooling repos: the workflow to deploy the tool as a Docker image 3. All repos: the workflow to sync labels Having duplicated workflows has two main disadvantages: 1. Updating the workflow means submitting a PR to each repository 2. Each repository gets their own dependabot update PRs Both of these disadvantages result in (many) notifications for track maintainers, which can be quite annoying. Solving these problems is done in three steps: 1. We've extracted the shared workflow functionality into reusable workflows that are stored in the exercism/github-actions repository: https://github.com/exercism/github-actions/tree/main/.github/workflows. 2. Modify the workflows currently having duplicated functionality to instead use the reusable workflows. 3. Automatically synchronize the modified workflows from the https://github.com/exercism/org-wide-files repository. Once all these steps have completed, the three above-mentioned cross-repository workflows: - will be identical across the different repositories - will rely on the reusable workflows for their functionality - won't receive dependabot updates as they don't have versioned github action imports (the reusable workflows use `@main`) - can easily be updated in a single location without needing bulk PRs While working on this, we've also made two tiny non-related changes (yeah, this is bad practice, I know :)): 1. We've prepared the `configlet` workflow to allow tracks to opt into also running `configlet fmt` (check the formatting of files in a track's repository). We still need to do a little work in the `org-wide-files` repo to allow track repositories to enable this, but in the end this should be as simple as setting a boolean flag to `true` in a (new) configuration file. 2. The workflows now all have explicit permissions, which improves their security. Note #1: sometimes we merge minor changes like typo fixes in `org-wide-files` without triggering a bulk PR. Therefore, there might be more files that are synced than just the reusable workflows. Note #2: there will be a follow-up PR cleaning up duplicate configlet workflows in case the track's configlet workflow has a different name.
There are three GitHub Actions workflows that are present in many Exercism repositories, but whose contents are identical: 1. Track repos: the workflow to run `configlet lint` 2. Tooling repos: the workflow to deploy the tool as a Docker image 3. All repos: the workflow to sync labels Having duplicated workflows has two main disadvantages: 1. Updating the workflow means submitting a PR to each repository 2. Each repository gets their own dependabot update PRs Both of these disadvantages result in (many) notifications for track maintainers, which can be quite annoying. Solving these problems is done in three steps: 1. We've extracted the shared workflow functionality into reusable workflows that are stored in the exercism/github-actions repository: https://github.com/exercism/github-actions/tree/main/.github/workflows. 2. Modify the workflows currently having duplicated functionality to instead use the reusable workflows. 3. Automatically synchronize the modified workflows from the https://github.com/exercism/org-wide-files repository. Once all these steps have completed, the three above-mentioned cross-repository workflows: - will be identical across the different repositories - will rely on the reusable workflows for their functionality - won't receive dependabot updates as they don't have versioned github action imports (the reusable workflows use `@main`) - can easily be updated in a single location without needing bulk PRs While working on this, we've also made two tiny non-related changes (yeah, this is bad practice, I know :)): 1. We've prepared the `configlet` workflow to allow tracks to opt into also running `configlet fmt` (check the formatting of files in a track's repository). We still need to do a little work in the `org-wide-files` repo to allow track repositories to enable this, but in the end this should be as simple as setting a boolean flag to `true` in a (new) configuration file. 2. The workflows now all have explicit permissions, which improves their security. Note #1: sometimes we merge minor changes like typo fixes in `org-wide-files` without triggering a bulk PR. Therefore, there might be more files that are synced than just the reusable workflows. Note #2: there will be a follow-up PR cleaning up duplicate configlet workflows in case the track's configlet workflow has a different name.
There are three GitHub Actions workflows that are present in many Exercism repositories, but whose contents are identical: 1. Track repos: the workflow to run `configlet lint` 2. Tooling repos: the workflow to deploy the tool as a Docker image 3. All repos: the workflow to sync labels Having duplicated workflows has two main disadvantages: 1. Updating the workflow means submitting a PR to each repository 2. Each repository gets their own dependabot update PRs Both of these disadvantages result in (many) notifications for track maintainers, which can be quite annoying. Solving these problems is done in three steps: 1. We've extracted the shared workflow functionality into reusable workflows that are stored in the exercism/github-actions repository: https://github.com/exercism/github-actions/tree/main/.github/workflows. 2. Modify the workflows currently having duplicated functionality to instead use the reusable workflows. 3. Automatically synchronize the modified workflows from the https://github.com/exercism/org-wide-files repository. Once all these steps have completed, the three above-mentioned cross-repository workflows: - will be identical across the different repositories - will rely on the reusable workflows for their functionality - won't receive dependabot updates as they don't have versioned github action imports (the reusable workflows use `@main`) - can easily be updated in a single location without needing bulk PRs While working on this, we've also made two tiny non-related changes (yeah, this is bad practice, I know :)): 1. We've prepared the `configlet` workflow to allow tracks to opt into also running `configlet fmt` (check the formatting of files in a track's repository). We still need to do a little work in the `org-wide-files` repo to allow track repositories to enable this, but in the end this should be as simple as setting a boolean flag to `true` in a (new) configuration file. 2. The workflows now all have explicit permissions, which improves their security. Note #1: sometimes we merge minor changes like typo fixes in `org-wide-files` without triggering a bulk PR. Therefore, there might be more files that are synced than just the reusable workflows. Note #2: there will be a follow-up PR cleaning up duplicate configlet workflows in case the track's configlet workflow has a different name.
There are three GitHub Actions workflows that are present in many Exercism repositories, but whose contents are identical: 1. Track repos: the workflow to run `configlet lint` 2. Tooling repos: the workflow to deploy the tool as a Docker image 3. All repos: the workflow to sync labels Having duplicated workflows has two main disadvantages: 1. Updating the workflow means submitting a PR to each repository 2. Each repository gets their own dependabot update PRs Both of these disadvantages result in (many) notifications for track maintainers, which can be quite annoying. Solving these problems is done in three steps: 1. We've extracted the shared workflow functionality into reusable workflows that are stored in the exercism/github-actions repository: https://github.com/exercism/github-actions/tree/main/.github/workflows. 2. Modify the workflows currently having duplicated functionality to instead use the reusable workflows. 3. Automatically synchronize the modified workflows from the https://github.com/exercism/org-wide-files repository. Once all these steps have completed, the three above-mentioned cross-repository workflows: - will be identical across the different repositories - will rely on the reusable workflows for their functionality - won't receive dependabot updates as they don't have versioned github action imports (the reusable workflows use `@main`) - can easily be updated in a single location without needing bulk PRs While working on this, we've also made two tiny non-related changes (yeah, this is bad practice, I know :)): 1. We've prepared the `configlet` workflow to allow tracks to opt into also running `configlet fmt` (check the formatting of files in a track's repository). We still need to do a little work in the `org-wide-files` repo to allow track repositories to enable this, but in the end this should be as simple as setting a boolean flag to `true` in a (new) configuration file. 2. The workflows now all have explicit permissions, which improves their security. Note #1: sometimes we merge minor changes like typo fixes in `org-wide-files` without triggering a bulk PR. Therefore, there might be more files that are synced than just the reusable workflows. Note #2: there will be a follow-up PR cleaning up duplicate configlet workflows in case the track's configlet workflow has a different name.
Use reusable workflows for cross-repository workflows There are three GitHub Actions workflows that are present in many Exercism repositories, but whose contents are identical: 1. Track repos: the workflow to run `configlet lint` 2. Tooling repos: the workflow to deploy the tool as a Docker image 3. All repos: the workflow to sync labels Having duplicated workflows has two main disadvantages: 1. Updating the workflow means submitting a PR to each repository 2. Each repository gets their own dependabot update PRs Both of these disadvantages result in (many) notifications for track maintainers, which can be quite annoying. Solving these problems is done in three steps: 1. We've extracted the shared workflow functionality into reusable workflows that are stored in the exercism/github-actions repository: https://github.com/exercism/github-actions/tree/main/.github/workflows. 2. Modify the workflows currently having duplicated functionality to instead use the reusable workflows. 3. Automatically synchronize the modified workflows from the https://github.com/exercism/org-wide-files repository. Once all these steps have completed, the three above-mentioned cross-repository workflows: - will be identical across the different repositories - will rely on the reusable workflows for their functionality - won't receive dependabot updates as they don't have versioned github action imports (the reusable workflows use `@main`) - can easily be updated in a single location without needing bulk PRs While working on this, we've also made two tiny non-related changes (yeah, this is bad practice, I know :)): 1. We've prepared the `configlet` workflow to allow tracks to opt into also running `configlet fmt` (check the formatting of files in a track's repository). We still need to do a little work in the `org-wide-files` repo to allow track repositories to enable this, but in the end this should be as simple as setting a boolean flag to `true` in a (new) configuration file. 2. The workflows now all have explicit permissions, which improves their security. Note #1: sometimes we merge minor changes like typo fixes in `org-wide-files` without triggering a bulk PR. Therefore, there might be more files that are synced than just the reusable workflows. Note #2: there will be a follow-up PR cleaning up duplicate configlet workflows in case the track's configlet workflow has a different name.
No description provided.