1- # Set DateClosed Field on Issue Close Action
1+ # Set Closed Date Field on Issue Close Action
22
3- This action updates the ` DateClosed ` project field when an issue is closed as completed. If an issue is reopened and closed again, the ` DateClosed ` field will reflect the latest date that it was closed.
3+ This action updates a date project field (default: ` DateClosed ` ) when an issue is closed as completed. If an issue is reopened and closed again, the field will reflect the latest date that it was closed.
44
55## Quick Reference
66
7- | Input | Description | Required | Default |
8- | -------------------- | --------------------------------------------- | -------- | ------- |
9- | ` issue-number ` | The issue number to check | Yes | - |
10- | ` issue-organization ` | The organization where the issue is located | No | - |
11- | ` issue-repo ` | The repository where the issue is located | No | - |
12- | ` project-number ` | The project number where the issue is located | Yes | - |
7+ | Input | Description | Required | Default |
8+ | -------------------- | --------------------------------------------------------- | -------- | ------------ |
9+ | ` token ` | PAT with required permissions (see below) | Yes | - |
10+ | ` issue-number ` | The issue number to check | Yes | - |
11+ | ` issue-organization ` | The organization where the issue is located | No | - |
12+ | ` issue-repo ` | The repository where the issue is located | No | - |
13+ | ` project-number ` | The project number where the issue is located | Yes | - |
14+ | ` date-field-name ` | The name of the date field to update the issue close date | No | ` DateClosed ` |
1315
1416** Requirements:**
1517
16- - Custom ` DateClosed ` field (Date type) in your project
17- - ` GH_TOKEN ` environment variable set to a Personal Access Token with ` repo ` , ` read:org ` , ` write:org ` , and ` project ` scopes
18+ - A custom date field (Date type) in your project (default name: ` DateClosed ` )
19+ - A Personal Access Token with ` repo ` , ` read:org ` , ` write:org ` , and ` project ` scopes
1820- Issue must be added to the specified project board
1921
2022## Setup
2123
22- ### 1. Create the DateClosed Custom Field
24+ ### 1. Create the Date Custom Field
2325
24261 . Navigate to your GitHub project board
25272 . Click the "+" icon to add a new field
26283 . Select "Custom field"
27- 4 . Name the field ` DateClosed ` and set type to ** Date**
29+ 4 . Name the field ` DateClosed ` (or your preferred name) and set type to ** Date**
28305 . Save the field
2931
3032### 2. Create Personal Access Token
@@ -42,8 +44,6 @@ This action updates the `DateClosed` project field when an issue is closed as co
42443 . Name: ` PAT ` , Value: your token
43454 . Click "Add secret"
4446
45- ** Note** : The action now uses the ` GH_TOKEN ` environment variable instead of a token input parameter.
46-
4747### 4. Find Your Project Number
4848
4949** From GitHub UI:** Look at your project URL: ` https://github.com/orgs/YOUR_ORG/projects/PROJECT_NUMBER `
@@ -57,7 +57,7 @@ gh project list --owner YOUR_ORG_OR_USERNAME
5757## Usage
5858
5959``` yaml
60- name : Set DateClosed Field on Issue Close
60+ name : Set Closed Date Field on Issue Close Action
6161
6262on :
6363 issues :
@@ -71,16 +71,15 @@ jobs:
7171 - name : Checkout repository
7272 uses : actions/checkout@v4
7373
74- - name : Set DateClosed Field on Issue Close
74+ - name : Set closed date field
7575 uses : dequelabs/axe-api-team-public/.github/actions/set-date-closed-field-v1@main
7676 with :
7777 issue-number : ${{ github.event.issue.number }}
7878 issue-organization : ${{ github.event.repository.owner.login }}
7979 issue-repo : ${{ github.event.repository.name }}
8080 project-number : ' 123' # Replace with your project number
81+ date-field-name : ' MyCustomDateField'
8182 token : ${{ secrets.PAT }}
82- env :
83- GH_TOKEN : ${{ secrets.PAT }}
8483` ` `
8584
8685**Important:** The default ` GITHUB_TOKEN` will not work for project operations. You must use a PAT as shown above.
@@ -90,37 +89,27 @@ jobs:
90891. **Issue Check** - Gets the issue details using the provided parameters
91902. **Closed Status Check** - Verifies the issue is closed and has a `closed_at` date
92913. **Project Item Lookup** - Finds the issue in the specified project board
93- 4. **DateClosed Field Update** - Updates the `DateClosed` field with the close date in YYYY-MM-DD format
92+ 4. **Date Field Update** - Updates the specified date field (default : ` DateClosed` ) with the close date in YYYY-MM-DD format
94935. **Re-closing Support** - If an issue is reopened and closed again, the field reflects the latest close date
9594
9695# # Troubleshooting
9796
98- # ## "Failed to get DateClosed field ID"
97+ # ## "Failed to get \<field name\> field ID"
9998
10099**Causes:**
101100
102101- Incorrect project number
103- - DateClosed field doesn't exist in the project
102+ - The specified date field doesn't exist in the project
104103- Token lacks project access
105104- Project is in a different organization
106105
107106**Solutions:**
108107
1091081. Verify project number using : ` gh project list --owner YOUR_ORG`
110- 2. Check if DateClosed field exists : ` gh project field-list PROJECT_NUMBER --owner YOUR_ORG --format json`
109+ 2. Check if the field exists : ` gh project field-list PROJECT_NUMBER --owner YOUR_ORG --format json`
1111103. Ensure PAT has all required scopes
1121114. Confirm project organization matches your expectations
113112
114- # ## "gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable"
115-
116- **Cause:** Missing or insufficient token permissions
117-
118- **Solutions:**
119-
120- 1. Verify PAT includes all required scopes : ` repo` , `read:org`, `write:org`, `project`
121- 2. Test token manually : ` gh project field-list PROJECT_NUMBER --owner YOUR_ORG --format json`
122- 3. Ensure token has access to the specific project
123-
124113# ## General Debugging Tips
125114
126115- **Test project access:** Use GitHub CLI commands locally with your PAT to verify access
0 commit comments