Repository navigation
ci: add issues and pull requests to the TripleTrail project - #59
Open
MathiasVDA wants to merge 5 commits into
Open
MathiasVDA wants to merge 5 commits into
MathiasVDA wants to merge 5 commits into
Conversation
New, reopened and transferred issues and pull requests are added to the organisation project as they come in. A manual run adds every existing one, open and closed. Needs the organisation secret PROJECT_TOKEN.
A transferred issue fires in the repository it leaves, and the new repository already sees it as opened. github-script v8 runs on Node 24, which the runners now force anyway. The comment names the secret as a repository secret.
Without the secret, on a fork's pull request or before it is added, the job now prints a notice and passes instead of failing every pull request.
Threads and people without access to the project can claim an item by labelling it: worker:builder-1 sets Worker, status:blocked sets Status. The option name is matched in lower case with dashes for spaces. Removing the last worker: label clears Worker; unrelated labels leave fields set by hand on the board alone.
Re-applying every label on each label event overwrote board changes made later, such as Done from the project's own workflow. Now a labeled event sets only its own field, removing a worker: label falls back to another worker: label or clears Worker, and a new item applies the labels it was created with. Concurrency is per item and label, so two labels added at once are both synced.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The project's own auto-add workflow covers one repository only. This workflow (
.github/workflows/project.yml) adds this repository's issues and pull requests to the organisation project TripleTrail:worker:<option>sets Worker (e.g.worker:builder-1) andstatus:<option>sets Status (e.g.status:blocked); the option name is matched in lower case with dashes for spaces. Only the label that changed is synced, so unrelated labels do nothing and a field set later on the board stays as it is. Removing aworker:label falls back to anotherworker:label or clears Worker.Pull requests use
pull_request_targetso that ones from forks are added too. The job checks out no code, so nothing from the pull request runs with the secret. Without the secret the job passes with a notice. The same file goes to all five TripleTrail repositories; the private ones run it on the NUC.It needs the repository secret
PROJECT_TOKEN, becauseGITHUB_TOKENcannot write to an organisation project: a fine-grained personal access token with resource owner Matdata-eu, the organisation permission "Projects: Read and write", and the repository permissions "Issues: Read" and "Pull requests: Read" on the TripleTrail repositories.New action:
actions/github-script@v8(MIT, by GitHub).How it was tested
YAML parses and the embedded script passes
node --check. The backfill ran green in the four other repositories. The label logic was run against a mocked GitHub API: opened with labels, setting both fields, an unrelated label, two worker labels, an unknown option, reopening, and removing a worker or status label.Documentation