Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/package-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
push-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6
with:
ssh-key: "${{ secrets.COMMIT_KEY }}"
- uses: actions/setup-node@v3
- uses: actions/setup-node@v6
with:
node-version: 16
node-version-file: "package.json"
- name: Install Javascript dependencies with npm
run: npm install
- name: Package action for distribution
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ jobs:
test-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build action on node v16
uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 16
node-version-file: "package.json"
- run: npm install
- run: npm run package
- run: npm run test
- name: Test action on node v20
uses: actions/setup-node@v3
with:
node-version: 20
- id: default
uses: ./
- name: Test current commit hash is used by default
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 > LIMITED and contributors
Copyright (c) 2026 shr.ink OÜ and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A GitHub Action for using the long and short [hash of a commit][git/commits]
— with an optional prefix.

```
prompt/actions-commit-hash@v3
prompt/actions-commit-hash@v4
```

:package: [Automatic Release Packaging](#automatic-release-packaging) is used by
Expand Down Expand Up @@ -41,10 +41,10 @@ jobs:
steps:
steps:
- id: commit
uses: prompt/actions-commit-hash@v3
- uses: docker/setup-buildx-action@v3
uses: prompt/actions-commit-hash@v4
- uses: docker/setup-buildx-action@v4
- name: Build image for commit
uses: docker/build-push-action@v5
uses: docker/build-push-action@v7
with:
push: true
tags: ${{ steps.commit.outputs.short }}
Expand All @@ -71,13 +71,13 @@ jobs:
steps:
steps:
- id: commit
uses: prompt/actions-commit-hash@v3
uses: prompt/actions-commit-hash@v4
with:
commit: "${{ github.event.workflow_run.head_sha }}"
prefix: "sha-"
- uses: docker/setup-buildx-action@v3
- uses: docker/setup-buildx-action@v4
- name: Build image for commit
uses: docker/build-push-action@v5
uses: docker/build-push-action@v7
with:
push: true
tags: ${{ steps.commit.outputs.short }}
Expand All @@ -90,8 +90,8 @@ Any reference to this Action in a Workflow must use a [tag][tags] (mutable) or
the commit hash of a tag (immutable).

```yaml
✅ uses: prompt/actions-commit-hash@v3
✅ uses: prompt/actions-commit-hash@v3.0.0
✅ uses: prompt/actions-commit-hash@v4
✅ uses: prompt/actions-commit-hash@v4.0.0
✅ uses: prompt/actions-commit-hash@01d19a83c242e1851c9aa6cf9625092ecd095d09
❌ uses: prompt/actions-commit-hash@main
```
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ outputs:
hash:
description: "Original, 40-character SHA-1 hash received as `commit` input"
runs:
using: "node20"
using: "node24"
main: "dist/index.js"
37 changes: 26 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"actions",
"github-actions"
],
"author": "Samuel Ryan <sam@samryan.co.uk>",
"author": "Samuel Ryan <sam@shr.ink>",
"license": "MIT",
"engines": {
"node": ">=16.0.0"
"node": ">=24.0.0"
},
"dependencies": {
"@actions/core": "^1.3.0"
Expand All @@ -27,7 +27,7 @@
"@types/jest": "^26.0.15",
"@types/node": "^14.14.9",
"@typescript-eslint/parser": "^5",
"@vercel/ncc": "^0.25.1",
"@vercel/ncc": "^0.38.4",
"eslint": "^8",
"eslint-plugin-github": "^4.1.1",
"eslint-plugin-jest": "^26",
Expand Down
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ async function run(): Promise<void> {
core.setOutput('short', prefix + commit.short())

core.setOutput('hash', commit.long())
} catch (error: any) {
core.setFailed(error.message)
} catch (error: unknown) {
core.setFailed(
error instanceof Error
? error.message
: 'an unknown error occurred when running actions-commit-hash'
)
}
}

Expand Down
Loading