|
1 |
| -# check-status |
| 1 | +<!-- start title --> |
| 2 | + |
| 3 | +# gitgitgadget Action: check-status |
| 4 | + |
| 5 | +<!-- end title --> |
| 6 | +<!-- start description --> |
| 7 | + |
| 8 | +This is a GitHub action to perform various scheduled actions with projects using gitgitgadget to submit changes. It is used as a scheduled action running in a separate repo or the repo it is acting upon. The use case is for repos that will not allow complex GitHub actions in the codebase when the GitHub repo is a clone that is used to submit updates to a non-GitHub maintained repo. |
| 9 | + |
| 10 | +<!-- end description --> |
| 11 | +<!-- start contents --> |
| 12 | +<!-- end contents --> |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +<!-- start usage --> |
| 17 | + |
| 18 | +```yaml |
| 19 | +- uses: gitgitgadget/gitgitgadget-action-check-status@v0.5.0 |
| 20 | + with: |
| 21 | + # The action to be performed. It must be one of the following: "update-open-prs", |
| 22 | + # "update-commit-mappings", "handle-open-prs", "handle-new-mails". |
| 23 | + action: "" |
| 24 | + |
| 25 | + # Repository owner. |
| 26 | + repo-owner: "" |
| 27 | + |
| 28 | + # Repository name. |
| 29 | + repo-name: "" |
| 30 | + |
| 31 | + # A repo scoped GitHub Personal Access Token. |
| 32 | + token: "" |
| 33 | + |
| 34 | + # The location of the repository. |
| 35 | + repository-dir: "" |
| 36 | + |
| 37 | + # The location of the repository with gitgitgadget configuration information. This |
| 38 | + # would be used in place of the `config` parameter for the `git` repository. This |
| 39 | + # is normally the gitgitgadget repo with any needed configuration settings. Most |
| 40 | + # users will specify a `config`. |
| 41 | + config-repository-dir: "" |
| 42 | + |
| 43 | + # JSON configuration for commands. |
| 44 | + config: "" |
| 45 | +``` |
| 46 | +
|
| 47 | +<!-- end usage --> |
| 48 | +
|
| 49 | +## Inputs |
| 50 | +
|
| 51 | +<!-- start inputs --> |
| 52 | +
|
| 53 | +| **Input** | **Description** | **Default** | **Required** | |
| 54 | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | ------------ | |
| 55 | +| **`action`** | The action to be performed. It must be one of the following: "update-open-prs", "update-commit-mappings", "handle-open-prs", "handle-new-mails". | | **true** | |
| 56 | +| **`repo-owner`** | Repository owner. | | **true** | |
| 57 | +| **`repo-name`** | Repository name. | | **true** | |
| 58 | +| **`token`** | A repo scoped GitHub Personal Access Token. | | **true** | |
| 59 | +| **`repository-dir`** | The location of the repository. | | **true** | |
| 60 | +| **`config-repository-dir`** | The location of the repository with gitgitgadget configuration information. This would be used in place of the `config` parameter for the `git` repository. This is normally the gitgitgadget repo with any needed configuration settings. Most users will specify a `config`. | | **false** | |
| 61 | +| **`config`** | JSON configuration for commands. | | **true** | |
| 62 | + |
| 63 | +<!-- end inputs --> |
| 64 | +<!-- start outputs --> |
| 65 | +<!-- end outputs --> |
| 66 | +<!-- start [.github/ghdocs/examples/] --> |
| 67 | +<!-- end [.github/ghdocs/examples/] --> |
| 68 | + |
| 69 | +## Contributing |
| 70 | +The current tests are Windows based. |
| 71 | + |
| 72 | +### Using a local `gitgitgadget` |
| 73 | +This action is a thin layer that uses [gitgitgadget](https://github.com/gitgitgadget/gitgitgadget) |
| 74 | +for most of the processing. If you have local changes to `gitgitgadget` that need to be |
| 75 | +tested: |
| 76 | +1. In the `gitgitgadget` project run `npm pack` to generate an installable package. By default, |
| 77 | +the package will be located in the root directory of the project. This can be changed by |
| 78 | +specifying `--pack-destination=` on the command. |
| 79 | +2. Change the `package.json` to point to the `tgz` packaage file and run `npm install gitgitgadget`. |
| 80 | + |
| 81 | +### action.yml changes |
| 82 | +Changes to `action.yml` require regenerating the `README.md`. This is done using `docker`. If it |
| 83 | +is not available it should be installed. The `README.md` is updated using `npm run build:readme`. |
| 84 | +**Note**: markup is very limited in the `action.yml`. |
| 85 | + |
| 86 | +### Source Changes |
| 87 | +The action is built using `npm run build`. This builds a standalone runnable at `dist/index.js`. |
| 88 | + |
| 89 | +### Testing |
| 90 | +The action supports four different checks. The checks and associated npm commands are: |
| 91 | + |
| 92 | +- update-open-prs (test:upr) |
| 93 | +- update-commit-mappings (test:ucm) |
| 94 | +- handle-open-prs (test:hop) |
| 95 | +- handle-new-mails (test:hnm) |
| 96 | + |
| 97 | +A windows command is provided for testing. It requires: |
| 98 | + |
| 99 | +1. A test repo set up to be monitored. A GitHub PAT must already be set as |
| 100 | + the INPUT_TOKEN environment variable or indentifed in a `.secret` file in |
| 101 | + the repo. The format of the `.secret` file is `INPUT_TOKEN=<pat>`. |
| 102 | +2. A config describing the test repo. |
| 103 | +3. For testing mail checks, a mail repo must be available with valid email. |
| 104 | + |
| 105 | +The test is run using the command: |
| 106 | + |
| 107 | +``` |
| 108 | +npm run <test-name> <test-repo-owner> <test-repo-name> <config-location> <email-repo-location> |
| 109 | +``` |
| 110 | +### Make a pull request |
| 111 | +First, if there are related `gitgitgadget` changes, that pull request should be done first. A fresh |
| 112 | +install, build and test should be done using the unmodified `package.json`. |
| 113 | + |
| 114 | +`npm version` may need to be done based on the level of change. If this is done, make sure the |
| 115 | +tags get pushed to GitHub. |
| 116 | + |
| 117 | +The patch series will need to include the `dist/index.js`. |
| 118 | + |
| 119 | +## TODO |
| 120 | +A separate action will be developed to rebuild the `dist/index.js` as needed when updates to |
| 121 | +`gitgitgadget` have been made. |
0 commit comments