Skip to content

Commit

Permalink
feat: add magic string to prevent out-of-order modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
prototypicalpro committed Dec 10, 2020
1 parent cab36b6 commit 2e58f1c
Show file tree
Hide file tree
Showing 14 changed files with 477 additions and 111 deletions.
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid"
"arrowParens": "avoid",
"jsdocParser": true
}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,15 @@ If `output_type` is set to `issue`, repolinter-action will create a GitHub issue

To prevent unnecessary noise, repolinter-action will first attempt to edit an existing open issue before creating a new one. This check is performed every workflow run, and can be emulated using the following [GitHub search](https://docs.github.com/en/github/searching-for-information-on-github) query:
```
type:issue repo:<the current repo> state:open creator:<username> label:<label-name> sort:author-date-desc
type:issue repo:<the current repo> creator:<username> label:<label-name> sort:author-date-desc
```
If no issues are returned by this query, repolinter-action will create a new one. If more than one issue is returned by this query, repolinter-action will edit the first one (most recently created) and ignore the others.

To prevent out-of-order action runs from generating issue noise, repolinter-action will search the body of the selected issue for a magic string containing the [`GITHUB_RUN_NUMBER`](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#about-environment-variables) of the last job that updated the issue; if the run number present in the issue is greater than the current run number, repolinter-action will assume that its results are out of date, and will not modify the issue. If the magic string is invalid, not present, or contains a lower run number, repolinter-action will assume its data is up to date and perform its modifications. At the moment, this magic string is encoded as follows:
```md
<!-- repolinter-action-workflow-number:<GITHUB_RUN_NUMBER> -->
```

## Contributing

We encourage your contributions to improve Repolinter Action! Keep in mind when you submit your pull request, you'll need to sign the CLA via the click-through using CLA-Assistant. You only have to sign the CLA one time per project.
Expand Down
Loading

0 comments on commit 2e58f1c

Please sign in to comment.