1
0
mirror of https://github.com/arduino/library-registry.git synced 2025-07-14 22:21:02 +03:00
Commit Graph

88 Commits

Author SHA1 Message Date
f678a3a457 Delete diff artifact after use in "Manage PRs" workflow
A workflow artifact is used to transfer the PR diff file from the `diff` job to the `parse` job. Once the artifact has
been downloaded by the `parse` job, it no longer serves any purpose.

It's possible the artifact might serve as a vector for exporting secrets from the workflow. Even though I don't have any
specific reasons to believe it is possible to cause secrets to be written to the artifact and the repository doesn't
currently have any secrets beyond `GITHUB_TOKEN`, nor need for any, it's still best to remove the unnecessary artifact.
2021-04-28 21:45:13 -07:00
ca4906f041 Don't run "Manage PRs" workflow on draft PRs
The draft mode clearly indicates that the PR is not ready for processing, so having the submission system run on these
PRs will only be an annoyance.
2021-04-28 21:01:06 -07:00
d8969cd40e Handle unexpected failures in "Manage PRs" workflow
The workflow already handles all expected failures in a manner that is as automated and friendly to the submitter as
possible.

However, there is always the chance for unexpected failures caused by a bug or service outage, which are in no way the
fault of the submitter. In this event, the workflow would previously fail without any clear explanation of what had
happened. This would be likely to cause confusion to the submitter. Since the system is very automated, this failure
might also go unnoticed by the repository maintainers.

A better way to handle unexpected failures is to:

- Add a special label ("status: maintenance required").
- Request a review from the Tooling Team.
- Comment to explain to the submitter that something went wrong and we will investigate.
2021-04-28 01:32:56 -07:00
f6342960d1 Restrict failure handling job runs to specific job failure
GitHub Actions workflow jobs default to the `if: success()` configuration. In this configuration, the job only runs when
the result of its job dependencies was success. When configuring a job to run on a failure result with `if: failure()` it
is logical to assume that the behavior would be inverted: the job would run only when the result of its dependency job
was failure. It does this, but also runs when its dependency job was canceled due to a failure of its own dependency.

This behavior of GitHub Actions resulted in the failure handling jobs running when they were not intended to. That is
avoided by specifying the exact job whose failure they were intended to handle in the conditional. It is still necessary
to use failure() in the conditional, otherwise they retain the default success() configuration and never run on a failure.
2021-04-28 01:27:30 -07:00
fd1da642b2 Merge pull request #21 from arduino/rename-job
Use less ambiguous name for workflow job handling non-submission PRs
2021-04-28 01:26:00 -07:00
f3a91c65e8 Use less ambiguous name for workflow job handling non-submission PRs
In the event a PR is detected as something other than a library submission, a review is requested from the Tooling Team
and a comment is made to the PR thread explaining the situation.

Previously, this job was named `request-review`. However, there are other circumstances under which a review will be
requested (e.g., merge conflict). So this was not a very good job name.

This job name is not referenced anywhere else in the workflow, so it currently only serves a documentation role and
changing it has no functional effect.
2021-04-27 23:21:42 -07:00
307f2802f9 Move comment re: "Unexpected input(s)" warnings for octokit/request-action to first usage
The `octokit/request-action` GitHub Actions action is designed to accept API request parameters as arbitrary action
inputs in the workflow. Because they have made no attempt to define all possible input keys in the action metadata,
normal and correct usage of the action cases GitHub Actions to display warnings in the workflow run log and summary. For
example:

Unexpected input(s) 'owner', 'repo', 'issue_number', 'labels', valid inputs are ['route', 'mediaType']

This has the potential to cause confusion, so I added a comment to the workflow explaining that this warning is expected
and doesn't indicate a problem. That comment somehow ended on a random occurence of `octokit/request-action` in the
workflow. It makes most sense to put it on the first usage of the action in the workflow, to make the information easy to
find.
2021-04-27 20:37:29 -07:00
610ddd71ff Merge pull request #16 from arduino/comment-feedback-issue-number
Remove unnecessary property reference from issue number definition for comment feedback comment
2021-04-27 08:30:30 -07:00
14d97cbc41 Merge pull request #18 from arduino/squash
Use squash merge for submission PRs
2021-04-27 08:30:15 -07:00
9710f18cd5 Provide assistance in the event of a merge conflict
It's certain that merge conflicts will occur as submitters take time to resolve blocking issues and other submissions are
accepted in the meantime. The PR merge will fail in this case.

Previously there was no provision for handling merge conflicts. The workflow run just failed at the merge job with no
comment from the bot.

The goal is for the automated system to work with the submitter as much as possible. Towards this goal, when the merge
fails, the bot will now comment to explain the problem and provide a link to a general tutorial for using the GitHub PR
merge conflict system.

A review is requested from the Tooling Team so that they can assist in the event the user is unable to resolve the merge
conflict, or the failure was caused by something else.
2021-04-27 07:51:47 -07:00
1df5fd85b5 Use squash merge for submission PRs
There is no good reason for a submission to consist of more than one commit.

As the submitter works with the bot to produce a compliant submission, they will sometimes end up with PRs that consist
of multiple non-atomic commits, which would pollute the repository's commit history if not squashed at the time of the
merge.
2021-04-26 21:55:19 -07:00
d83eb2b22c Remove unnecessary property reference from issue number definition for comment feedback comment
The "Manage PRs" workflow can be triggered by either a `pull_request_target` or `issue_comment` event. This means that
the `issue_number` parameter of the GitHub API request must be defined using both the `github.event.pull_request.number`
and `github.event.issue.number` properties because a different one is defined depending on which event was the trigger.
The exception is the API request for the bot comment used to provide immediate feedback when the workflow is triggered by
a comment. This API request is only ever used with an issue_comment event trigger, so the
github.event.pull_request.number property is not needed.
2021-04-26 17:07:09 -07:00
de21247de0 Remove unnecessary enabled job from "Manage PRs" workflow
This job was an artifact from an earlier version of the workflow, and was no longer necessary. It only added additional
code.
2021-04-26 14:23:02 -07:00
23c59049c4 Merge pull request #13 from arduino/comment-on-comment-trigger
Provide immediate response to comment trigger
2021-04-26 01:36:58 -07:00
83b4acfac7 Provide immediate response to comment trigger
When there is a problem with the submission that must be resolved in the library repository, a comment mentioning
`@ArduinoBot` is used to trigger the "Manage PRs" workflow.

We are accustomed to seeing the checks status in the PR thread when workflows are running. However, with a comment
triggered workflow this does not happen. The only indication of the workflow running is on the "Actions" tab. This can
leave the submitter wondering if their comment had any effect as the workflow takes some time to run before providing
feedback.

This uncertainty can be avoided by making the bot immediately comment to acknowledge that the check is in progress.
2021-04-25 23:35:39 -07:00
cad90e58f6 Comment on submission acceptance
Previously, as soon as a submission was compliant, the PR was merged silently. This might leave the submitter wondering
whether the submission process is complete.

There is some uncertain delay for the library release to be added to the server, the index to be generated, and the index
to propagate through the CDN, which might result in an increased support burden as the submitters comment or open issues
asking what is happening.

This is avoided by making the bot comment on the PR thread after the PR is merged, notifying the submitter that the
process was successful and that there will be some delay before the library is available from Library Manager.

Indexer logs URLs are provided for each submission, allowing the submitter to monitor the indexing process, both
immediately after the acceptance, as well as after they make future releases.
2021-04-25 22:21:36 -07:00
e1d572d8ab Merge pull request #9 from arduino/format-yaml
Reduce excessive line lengths in YAML files
2021-04-14 02:39:19 -07:00
016fc6cb8c Use custom matrix job names in check-submissions job
The "Manage PRs" GitHub Actions workflow generates a matrix job for each library submitted by the PR. The default job
name is generated from the job's matrix object. This contains the complete submission data, which results in a long and
somewhat cryptic job name that can make the workflow run more difficult to interpret.

The only necessary information is the description of the job's purpose ("check") and the submission URL (multiple URLs
per PR are supported). A custom job name allows for only using this information in the job name.
2021-04-14 00:50:06 -07:00
d96fcc48fd Reduce excessive line lengths in YAML files
The yamllint configuration advocates for keeping line lengths within 120 characters. While exceeding this length only
results in a warning, I think it is beneficial to stay within that limit when it is possible and doesn't have a harmful
effect. In that spirit, I have reduced the long lines where this was easily done. There remain a few that are either not
possible or else not reasonable to reduce, and that's OK.
2021-04-13 17:48:16 -07:00
eafd6bbaf9 Remove dependencies caching from workflows
After I set up caching in the template workflows, doubts were raised about whether it provided any benefits. I don't know
enough about this subject to make a call on that and I have been unable to get any more information on the subject.

Since the caching significantly increases the complexity of the workflows, which may make them more difficult to maintain
and contribute to, I think it's best to just remove all the caching for now. I hope to eventually be able to revisit this
topic and restore caching in any workflows where it is definitely beneficial.
2021-04-12 02:45:29 -07:00
0c09834a08 Bring workflow into compliance with the JSON schema 2021-04-09 09:32:26 -07:00
30aeffc9b0 Add CI workflow to lint YAML files
On every push and pull request that affects relevant files, and periodically, run yamllint to check the YAML files of
the repository for issues.

The .yamllint.yml file is used to configure yamllint:
https://yamllint.readthedocs.io/en/stable/configuration.html
2021-04-09 09:32:26 -07:00
834af544d0 Add CI workflow to validate GitHub Actions workflows
On every push or pull request that affects the repository's GitHub Actions workflows, and periodically, validate them
against the JSON schema.
2021-04-09 08:52:43 -07:00
4b40e08342 Add table of contents to documentation
It will be helpful to the reader to be able to get an overview of the documentation content and quickly navigate to the
section of interest.

The table of contents are automatically generated using the markdown-toc tool.

Because it can be easy to forget to update the table of contents when the documentation content is changed, I have added
a CI workflow to check for missed updates to readme ToC. On every push or pull request that affects the repository's
documentation, it will check whether the table of contents matches the content.
2021-04-09 08:42:55 -07:00
7947b23061 Change license to Creative Commons Zero v1.0 Universal
Now that the parser tool code has been removed from the repository, the previous license is no longer appropriate.
2021-03-31 09:17:49 -07:00
3a5826a784 Simplify license check CI system
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the
CI infrastructure. In order to make the repository more contributor-friendly, the license checking system is now
confined to a single workflow file.
2021-03-31 09:17:25 -07:00
d38ccc82a0 Simplify documentation and configuration file CI system
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the
CI infrastructure. In order to make the repository more contributor-friendly, the documentation and configuration
checking system is now confined to the .github subfolder.
2021-03-31 09:16:20 -07:00
7d32d9911e Simplify code spell CI system
Now that the parser tool is moved out of the repository, it makes less sense to use the taskfile-based approach for the
CI infrastructure. In order to make the repository more contributor-friendly, the spell checking system is now reduced to
a single workflow file.
2021-03-31 09:16:20 -07:00
b0eccfe5b6 Move submission parser tool to dedicated repository 2021-03-31 09:16:20 -07:00
cb6c0a2bb5 Use curl to get PR diff
This approach allows the diff to be written directly to a file, rather than needing to sanitize the contents of the
output from the octokit/request-action before writing it to the file via the shell.
2021-02-01 21:44:35 -08:00
da261b4a79 Correct readme URL in bot comments 2021-02-01 02:30:33 -08:00
a7ef80e1a4 Get PR diff from GitHub API
This avoids the need to checkout the PR head ref.
2021-02-01 02:30:33 -08:00
f5928a6800 Host index source file in repository
The index source file contains the normalized URL and the metadata that can't be derived from the library releases
("types" data and locked name) for each of the libraries in the Library Manager index. It's most appropriate to store it
in the same repository as the submission list.
2021-01-20 22:06:43 -08:00
1cdeda201c Remove untested triggers from the "Manage PRs" workflow
I had intended to test these out but didn't get around to it. The workflow_dispatch might be convenient, but it's not at
all essential since the same thing can be accomplished by commenting on the PR.
2021-01-20 00:51:40 -08:00
b871bfcb5a Get PR diff in dedicated job
This isolates the PR branch checkout from the request parsing process.
2021-01-20 00:51:40 -08:00
7071c247b0 Export index entry as workflow artifact
Rather that committing directly to the index source file repository, save the index entry to a workflow artifact, which
will be consumed by the system that updates the index source file.
2021-01-20 00:51:35 -08:00
3fc5f76339 Don't use index source file for URL duplication check
It's possible to accomplish the same thing in a more simple and secure manner by using the submission list.
2021-01-20 00:51:03 -08:00
050ac29d24 Automate the Library Manager submission process
Submissions of libraries to the Arduino Library Manager index can be done by submitting a pull request adding repositor
URLs to the list. The submissions are checked for compliance wih the requirements for addition to the index and as soon
as they are passing the pull request is merged and the entries are pushed to the index source file.
2021-01-19 00:05:38 -08:00