Skip to content

Commit 83f971d

Browse files
authored
Merge pull request #83 from saadmk11/set-output
Set Created Pull Request Number as Action Output
2 parents 241f4fc + 84fcfb6 commit 83f971d

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,47 @@ jobs:
199199
# ...
200200
```
201201

202+
### Outputs
203+
204+
| Output Name | Description |
205+
| ----------- |-----------------------------------------|
206+
| `GHA_UPDATE_PR_NUMBER` | The number of the created pull request. |
207+
208+
#### Example Workflow
209+
210+
```yaml
211+
name: GitHub Actions Version Updater
212+
213+
# Controls when the action will run.
214+
on:
215+
# can be used to run workflow manually
216+
workflow_dispatch:
217+
schedule:
218+
# Automatically run on every Sunday
219+
- cron: '0 0 * * 0'
220+
221+
jobs:
222+
build:
223+
runs-on: ubuntu-latest
224+
225+
steps:
226+
- uses: actions/checkout@v2
227+
with:
228+
# [Required] Access token with `workflow` scope.
229+
token: ${{ secrets.WORKFLOW_SECRET }}
230+
231+
- name: Run GitHub Actions Version Updater
232+
uses: saadmk11/github-actions-version-updater@v0.7.4
233+
# Required to get the PR number
234+
id: gha-update
235+
with:
236+
# [Required] Access token with `workflow` scope.
237+
token: ${{ secrets.WORKFLOW_SECRET }}
238+
skip_pull_request: 'false'
239+
- name: Get PR Number
240+
run: echo "The PR Number is ${{ steps.gha-update.outputs.GHA_UPDATE_PR_NUMBER }}"
241+
```
242+
202243
### Alternative
203244
204245
You can also use [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot) to update your GitHub Actions.

src/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def run(self) -> None:
8585
self.user_config.token,
8686
)
8787
if pull_request_number is not None:
88+
gha_utils.set_output("GHA_UPDATE_PR_NUMBER", pull_request_number)
8889
add_pull_request_reviewers(
8990
self.env.repository,
9091
pull_request_number,

0 commit comments

Comments
 (0)