Skip to content

Commit

Permalink
Populate pull request commit details and update packages (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
terryknowlton authored Dec 4, 2024
1 parent b94fe32 commit 5aaf312
Show file tree
Hide file tree
Showing 6 changed files with 324 additions and 186 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@ This action defines the same rich [environment variables as Codeship Pro](https:

The action enables running existing Codeship scripts that reference variables like `CI_COMMIT_MESSAGE`, without having to refactor them to [GitHub Workflows Syntax](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions). Using this action, you can share scripts across your GitHub Workflow and Codeship builds, getting the best of both worlds 🎉.

## Input arguments

### `github-token`
(Optional) A github token is required to populate the `CI_COMMIT_MESSAGE` for workflows triggered by a pull_request event

### `project-id`
(Optional) If provided `project-id` will be used to populate `CI_PROJECT_ID` in the github environment

## Example Workflow Step

```yaml
name: Where are my env var?
steps:
- uses: twistedpair/codeship-env-adapter@v1
with:
project-id: '123abc-project-id' # provide your project id, if you fancy
# Provide github-token if you need to populate commit messages for pull_request event triggers
github-token: ${{ secrets.GITHUB_TOKEN }}
# provide your project id, if you fancy
project-id: '123abc-project-id'

- name: Playback some env vars
run: echo "Hi, I'm build $CI_COMMIT_ID"
Expand All @@ -29,8 +40,8 @@ steps:
- `CI_COMMIT_MESSAGE`
- `CI_NAME` - will be `github`
- `CI_PROJECT_ID` - only set if provided as `project-id` in Action `with` config
- `CI_PR_NUMBER` - blank
- `CI_PULL_REQUEST` - `false`
- `CI_PR_NUMBER` - repo specific pull request number (pull_request events only)
- `CI_PULL_REQUEST` - github url of the pull request associated with the triggered event (pull_request events only)
- `CI_REPO_NAME` - repo short name (not the full name) e.g. `my-repo`
- `CI_STRING_TIME` - e.g. `2020-02-09T22:33:55Z`
- `CI_TIMESTAMP` - e.g. `1581287635`
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ branding:
icon: life-buoy
color: orange
inputs:
github-token:
description: 'Optional: GitHub token with permissions to look up commit and pull request details so that CI_COMMIT_MESSAGE is populated with the HEAD commit message'
required: false
project-id:
description: (optional) Codeship project id
required: false
Expand Down
Loading

0 comments on commit 5aaf312

Please sign in to comment.